Class: ThreeScale::Backend::Rack::InternalErrorCatcher
- Inherits:
-
Object
- Object
- ThreeScale::Backend::Rack::InternalErrorCatcher
- Defined in:
- lib/3scale/backend/rack/internal_error_catcher.rb
Overview
This middleware should be the last one to run. If there’s an exception, instead of propagating it to the web server, we set our own error message. The reason is that each web server handles this differently. Puma returns a generic error message, while Falcon returns the message of the exception.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ InternalErrorCatcher
constructor
A new instance of InternalErrorCatcher.
Constructor Details
#initialize(app) ⇒ InternalErrorCatcher
Returns a new instance of InternalErrorCatcher.
11 12 13 |
# File 'lib/3scale/backend/rack/internal_error_catcher.rb', line 11 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
15 16 17 18 19 |
# File 'lib/3scale/backend/rack/internal_error_catcher.rb', line 15 def call(env) @app.call(env) rescue [500, {}, ["Internal Server Error\n".freeze]] end |