Class: Redmine::Reporting::Rails::Middleware
- Inherits:
-
Object
- Object
- Redmine::Reporting::Rails::Middleware
- Defined in:
- lib/redmine/reporting/rails/middleware.rb
Overview
Rack middleware for Rails applications. Any errors raised by the upstream application will be send to Redmine and re-raised.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ Middleware
constructor
A new instance of Middleware.
Constructor Details
#initialize(app) ⇒ Middleware
Returns a new instance of Middleware.
7 8 9 |
# File 'lib/redmine/reporting/rails/middleware.rb', line 7 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/redmine/reporting/rails/middleware.rb', line 11 def call(env) begin response = @app.call(env) rescue Exception => exception env['redmine_reporting.reference_id'] = redmine_report(env, exception) raise exception end if framework_exception = env['action_dispatch.exception'] env['redmine_reporting.reference_id'] = redmine_report(env, framework_exception) end response end |