Module: Rambulance

Defined in:
lib/rambulance/engine.rb,
lib/rambulance.rb,
lib/rambulance/railtie.rb,
lib/rambulance/version.rb,
lib/rambulance/test_helper.rb,
lib/rambulance/exceptions_app.rb,
lib/generators/rambulance/install_generator.rb,
lib/generators/rambulance/exceptions_app_generator.rb

Overview

:nodoc:

Defined Under Namespace

Modules: Generators, TestHelper Classes: Engine, ExceptionsApp, Railtie

Constant Summary collapse

VERSION =
"3.3.0"
ERROR_HTTP_STATUSES =
Rack::Utils::SYMBOL_TO_STATUS_CODE.select do |status_in_words, http_status|
  # Exclude http statuses that:
  #   * represent a successful status(2xx, 3xx)
  #   * are unassigned(427, 430, 509)
  #   * is a joke definition(418)
  http_status >= 400 && ![418, 427, 430, 509].include?(http_status)
end.invert
BAD_REQUEST_ERRORS =
[
  ActionController::BadRequest,
  # Rails >= 7.1.0
  defined?(ActionDispatch::Http::MimeNegotiation::InvalidType) ? ActionDispatch::Http::MimeNegotiation::InvalidType : nil,
  # Rails >= 5.2.0
  defined?(ActionDispatch::Http::Parameters::ParseError) ? ActionDispatch::Http::Parameters::ParseError : nil,
  # Rails < 5.2.0
  defined?(ActionDispatch::ParamsParser::ParseError) ? ActionDispatch::ParamsParser::ParseError : nil
].compact.freeze
@@rescue_responses =
{}
@@layout_name =
"application"
@@view_path =
"errors"

Class Method Summary collapse

Class Method Details

.rescue_responses=(rescue_responses) ⇒ Object



20
21
22
23
# File 'lib/rambulance.rb', line 20

def self.rescue_responses=(rescue_responses)
  @@rescue_responses = rescue_responses
  ActionDispatch::ExceptionWrapper.rescue_responses.merge!(rescue_responses)
end

.setup {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:

  • _self (Rambulance)

    the object that the method was called on



25
26
27
# File 'lib/rambulance.rb', line 25

def self.setup
  yield self
end