class Rack::Exceptions

Public Class Methods

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

Public Instance Methods

call(env) click to toggle source
# File lib/rack/exceptions.rb, line 8
def call(env)
  begin
    response = @app.call(env)
  rescue Exception => e
    backend.notify(e, rack_env: env)
    raise
  end

  response
ensure
  backend.clear_context
end

Private Instance Methods

backend() click to toggle source
# File lib/rack/exceptions.rb, line 23
def backend
  @backend ||= ::Exceptions.configuration.backend
end