Class: Grape::Middleware::Error

Inherits:
Base
  • Object
show all
Extended by:
Forwardable
Includes:
PrecomputedContentTypes
Defined in:
lib/grape/middleware/error.rb

Defined Under Namespace

Classes: Options

Constant Summary collapse

DEFAULT_OPTIONS =
Deprecated.

Kept as a frozen Hash representation of the Options defaults for back-compat. Will be removed in a future release.

Options.new.to_h.freeze

Instance Attribute Summary

Attributes inherited from Base

#app, #config, #env, #options

Instance Method Summary collapse

Methods included from PrecomputedContentTypes

#content_type, #content_type_for, #content_types, #initialize, #mime_types

Methods inherited from Base

#after, #before, #call, #context, #initialize, #query_params, #rack_request, #response

Methods included from DSL::Headers

#header

Instance Method Details

#call!(env) ⇒ Object



51
52
53
54
55
56
# File 'lib/grape/middleware/error.rb', line 51

def call!(env)
  @env = env
  error_response(catch(:error) { return @app.call(@env) })
rescue Exception => e # rubocop:disable Lint/RescueException
  run_rescue_handler(find_handler(e.class), e, @env[Grape::Env::API_ENDPOINT])
end