aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/middleware/rescue.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib/action_dispatch/middleware/rescue.rb')
-rw-r--r--actionpack/lib/action_dispatch/middleware/rescue.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/actionpack/lib/action_dispatch/middleware/rescue.rb b/actionpack/lib/action_dispatch/middleware/rescue.rb
new file mode 100644
index 0000000000..1456825526
--- /dev/null
+++ b/actionpack/lib/action_dispatch/middleware/rescue.rb
@@ -0,0 +1,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