Class: Sentiero::Reporter::Middleware

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

Overview

Rack middleware that reports unhandled exceptions to Sentiero and re-raises them so the host app's own error handling is unaffected. Reads the recorder's session/window id cookies into the context so server exceptions link to the replay.

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Middleware

Returns a new instance of Middleware.



13
14
15
# File 'lib/sentiero/reporter/middleware.rb', line 13

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



17
18
19
20
21
22
23
24
# File 'lib/sentiero/reporter/middleware.rb', line 17

def call(env)
  Reporter.with_context(request_context(env)) do
    @app.call(env)
  rescue => e
    Reporter.notify(e)
    raise
  end
end