Class: Dispatch::Rails::Middleware

Inherits:
Object
  • Object
show all
Defined in:
lib/dispatch/rails/middleware.rb

Overview

Innermost Rack middleware: it wraps the app directly, so an unhandled exception is seen here (with the full request env, including the controller instance for user resolution) before any exception-rendering middleware. We capture and re-raise — never swallow.

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Middleware

Returns a new instance of Middleware.



8
9
10
# File 'lib/dispatch/rails/middleware.rb', line 8

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



12
13
14
15
16
17
# File 'lib/dispatch/rails/middleware.rb', line 12

def call(env)
  @app.call(env)
rescue Exception => e # rubocop:disable Lint/RescueException
  Dispatch::Rails::Reporter.capture(e, handled: false, env: env)
  raise
end