Class: BetterErrors::Middleware
- Inherits:
-
Object
- Object
- BetterErrors::Middleware
- Defined in:
- lib/better_errors/middleware.rb
Overview
Better Errors' error handling middleware. Including this in your middleware stack will show a Better Errors error page for exceptions raised below this middleware.
If you are using Ruby on Rails, you do not need to manually insert this middleware into your middleware stack.
Instance Method Summary collapse
-
#call(env) ⇒ Array
Calls the Better Errors middleware.
-
#initialize(app, handler = ErrorPage) ⇒ Middleware
constructor
A new instance of BetterErrors::Middleware.
Constructor Details
#initialize(app, handler = ErrorPage) ⇒ Middleware
A new instance of BetterErrors::Middleware
29 30 31 32 |
# File 'lib/better_errors/middleware.rb', line 29 def initialize(app, handler = ErrorPage) @app = app @handler = handler end |
Instance Method Details
#call(env) ⇒ Array
Calls the Better Errors middleware
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/better_errors/middleware.rb', line 38 def call(env) case env["PATH_INFO"] when %r{\A/__better_errors/(?<oid>-?\d+)/(?<method>\w+)\z} internal_call env, $~ when %r{\A/__better_errors/?\z} show_error_page env else app_call env end end |