Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

FailMiddleware from old failurous-rails, using the failurous-ruby's F…

…ailurous.notify
  • Loading branch information...
commit 5de58aa301aa4882b79c3cc9213ea365d1ca588d 1 parent 239a69e
@mnylen authored
Showing with 24 additions and 0 deletions.
  1. +24 −0 lib/failurous/rails/fail_middleware.rb
View
24 lib/failurous/rails/fail_middleware.rb
@@ -0,0 +1,24 @@
+module Failurous::Rails
+ class FailMiddleware
+ def initialize(app)
+ @app = app
+ end
+
+ def call(env)
+ @app.call(env)
+ rescue Exception => exception
+ unless Failurous.notifier.config.ignore_exceptions.include?(exception.class)
+ notify_of_exception(env, exception)
+ end
+
+ raise exception
+ end
+
+ private
+
+ def notify_of_exception(env, exception)
+ controller = env['action_controller.instance'] || MissingController.new
+ Failurous.notify(exception, controller)
+ end
+ end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.