Class: ErrorRadar::Middleware

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

Overview

Rack middleware that captures every unhandled web-layer exception as an ErrorLog, then re-raises so Rails’ normal exception rendering still happens. Inserted just below ActionDispatch::DebugExceptions.

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Middleware

Returns a new instance of Middleware.



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

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



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

def call(env)
  @app.call(env)
rescue Exception => e # rubocop:disable Lint/RescueException
  capture(e, env) unless ignored?(e)
  raise
end