Class: ExceptionDog::Integrations::Rack

Inherits:
Object
  • Object
show all
Defined in:
lib/exception_dog/integrations/rack.rb

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Rack

Returns a new instance of Rack.



3
4
5
# File 'lib/exception_dog/integrations/rack.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
18
19
# File 'lib/exception_dog/integrations/rack.rb', line 7

def call(env)
  begin
    response = @app.call(env)
  rescue Exception => raised
    data = {
      request_uri: env["REQUEST_URI"],
      remote_ip: env["HTTP_X_FORWARDED_FOR"] || env["HTTP_FORWARDED_FOR"]
    }
    ExceptionDog.notify(raised, data)
    raise raised
  end
  response
end