Class: ApiValve::Middleware::ErrorHandling
- Inherits:
-
Object
- Object
- ApiValve::Middleware::ErrorHandling
- Defined in:
- lib/api_valve/middleware/error_handling.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ ErrorHandling
constructor
A new instance of ErrorHandling.
Constructor Details
#initialize(app) ⇒ ErrorHandling
Returns a new instance of ErrorHandling.
3 4 5 |
# File 'lib/api_valve/middleware/error_handling.rb', line 3 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
7 8 9 10 11 12 |
# File 'lib/api_valve/middleware/error_handling.rb', line 7 def call(env) @app.call(env) rescue Exception => e # rubocop:disable Lint/RescueException log_error e self.class.const_get(ApiValve.error_responder).new(e).call end |