Class: Hanami::Middleware::RenderErrors Private
- Inherits:
-
Object
- Object
- Hanami::Middleware::RenderErrors
- Defined in:
- lib/hanami/middleware/render_errors.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Rack middleware that rescues errors raised by the app renders friendly error responses, via a given “errors app”.
By default, this is enabled only in production mode.
Defined Under Namespace
Classes: RenderableException
Instance Method Summary collapse
- #call(env) ⇒ Object private
-
#initialize(app, config, errors_app) ⇒ RenderErrors
constructor
private
A new instance of RenderErrors.
Constructor Details
#initialize(app, config, errors_app) ⇒ RenderErrors
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of RenderErrors.
48 49 50 51 52 |
# File 'lib/hanami/middleware/render_errors.rb', line 48 def initialize(app, config, errors_app) @app = app @config = config @errors_app = errors_app end |
Instance Method Details
#call(env) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
56 57 58 59 60 61 62 |
# File 'lib/hanami/middleware/render_errors.rb', line 56 def call(env) @app.call(env) rescue Exception => exception raise unless @config.render_errors render_exception(env, exception) end |