Class: Rack::Exceptions

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

Instance Method Summary collapse

Constructor Details

#initialize(app, backend = nil) ⇒ Exceptions

Returns a new instance of Exceptions.



3
4
5
6
# File 'lib/rack/exceptions.rb', line 3

def initialize(app, backend = nil)
  @app     = app
  @backend = backend
end

Instance Method Details

#call(env) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/rack/exceptions.rb', line 8

def call(env)
  begin
    response = @app.call(env)
  rescue Exception => e
    backend.rack_exception(e, env)
    raise
  end

  response
ensure
  backend.clear_context
end