Class: Telebugs::Rails::ReportErrors
- Inherits:
-
Object
- Object
- Telebugs::Rails::ReportErrors
- Defined in:
- lib/telebugs/rails/report_errors.rb
Overview
Telebugs middleware for Rails. Any errors raised by the upstream application will be delivered to Telebugs and re-raised.
Instance Method Summary collapse
- #call(env) ⇒ Object
- #call!(env) ⇒ Object
-
#initialize(app) ⇒ ReportErrors
constructor
A new instance of ReportErrors.
Constructor Details
#initialize(app) ⇒ ReportErrors
Returns a new instance of ReportErrors.
7 8 9 |
# File 'lib/telebugs/rails/report_errors.rb', line 7 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
11 12 13 |
# File 'lib/telebugs/rails/report_errors.rb', line 11 def call(env) dup.call!(env) end |
#call!(env) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/telebugs/rails/report_errors.rb', line 15 def call!(env) response = call_app(env) # The exceptions app should be passed as a parameter on initialization of # ShowExceptions. Every time there is an exception, ShowExceptions will # store the exception in env["action_dispatch.exception"], rewrite the # PATH_INFO to the exception status code, and call the Rack app. # See: https://api.rubyonrails.org/classes/ActionDispatch/ShowExceptions.html return response unless env["action_dispatch.exception"] Telebugs.report(env["action_dispatch.exception"]) response end |