Class: Rack::RailsExceptional

Inherits:
Object
  • Object
show all
Defined in:
lib/exceptional/integration/rack_rails.rb

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ RailsExceptional

Returns a new instance of RailsExceptional.



7
8
9
# File 'lib/exceptional/integration/rack_rails.rb', line 7

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/exceptional/integration/rack_rails.rb', line 11

def call(env)
  begin
    body = @app.call(env)
  rescue Exception => e
    ::Exceptional::Catcher.handle_with_controller(e,env['action_controller.instance'], Rack::Request.new(env))
    raise
  end

  if env['rack.exception']
    ::Exceptional::Catcher.handle_with_controller(env['rack.exception'],env['action_controller.instance'], Rack::Request.new(env))
  end

  body
end