Class: TraceForge::Middleware

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

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Middleware

Returns a new instance of Middleware.



3
4
5
# File 'lib/traceforge/middleware.rb', line 3

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/traceforge/middleware.rb', line 7

def call(env)
  begin
    @app.call(env)
  rescue Exception => exception
    TraceForge::Client.capture_exception(exception, {
      url: env['REQUEST_URI'],
      method: env['REQUEST_METHOD']
    })
    raise exception
  end
end