class ExceptionDog::Integrations::Rack

Public Class Methods

new(app) click to toggle source
# File lib/exception_dog/integrations/rack.rb, line 3
def initialize(app)
  @app = app
end

Public Instance Methods

call(env) click to toggle source
# 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