aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/middleware/rescue.rb
blob: 1456825526cc1a7d9048f163bcbc3d02a158d540 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
module ActionDispatch
  class Rescue
    def initialize(app, rescuer)
      @app, @rescuer = app, rescuer
    end

    def call(env)
      @app.call(env)
    rescue Exception => exception
      env['action_dispatch.rescue.exception'] = exception
      @rescuer.call(env)
    end
  end
end