Method: Insights::API::Common::ApplicationControllerMixins::ExceptionHandling#error_code_from_class

Defined in:
lib/insights/api/common/application_controller_mixins/exception_handling.rb

#error_code_from_class(exception) ⇒ Object



50
51
52
53
54
55
56
# File 'lib/insights/api/common/application_controller_mixins/exception_handling.rb', line 50

def error_code_from_class(exception)
  if ActionDispatch::ExceptionWrapper.rescue_responses.key?(exception.class.to_s)
    Rack::Utils.status_code(ActionDispatch::ExceptionWrapper.rescue_responses[exception.class.to_s])
  else
    DEFAULT_ERROR_CODE
  end
end