Module: Mosaic::Errors::ClassMethods

Defined in:
lib/mosaic/errors.rb

Constant Summary collapse

DEFAULT_RESCUE_RESPONSE =
:internal_server_error
DEFAULT_RESCUE_RESPONSES =
{
  'ActionController::RoutingError'             => :not_found,
  'ActionController::UnknownAction'            => :not_found,
  'ActiveRecord::RecordNotFound'               => :not_found,
  'ActiveRecord::StaleObjectError'             => :conflict,
  'ActiveRecord::RecordInvalid'                => :unprocessable_entity,
  'ActiveRecord::RecordNotSaved'               => :unprocessable_entity,
  'ActionController::MethodNotAllowed'         => :method_not_allowed,
  'ActionController::NotImplemented'           => :not_implemented,
  'ActionController::InvalidAuthenticityToken' => :unprocessable_entity
}

Instance Method Summary collapse

Instance Method Details

#rescue_responsesObject



36
37
38
# File 'lib/mosaic/errors.rb', line 36

def rescue_responses
  @rescue_responses ||= Hash.new(DEFAULT_RESCUE_RESPONSE).merge(DEFAULT_RESCUE_RESPONSES)
end