class ErrorInbox::Rack

Public Class Methods

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

Public Instance Methods

call(env) click to toggle source
# File lib/error_inbox/rack.rb, line 7
def call(env)
  begin
    response = @app.call(env)
  rescue Exception => raised
    ErrorInbox.notify(raised, env)
    raise raised
  end

  if framework_exception(env)
    ErrorInbox.notify(framework_exception(env), env)
  end

  response
end

Protected Instance Methods

framework_exception(env) click to toggle source
# File lib/error_inbox/rack.rb, line 24
def framework_exception(env)
  env["rack.exception"] || env["action_dispatch.exception"] || env["sinatra.error"]
end