Permalink
Browse files

Added ignore_if option.

  • Loading branch information...
1 parent 7745cb7 commit 7fe1a7f0e2316f1a426f1469c7bd7a27edc54bf7 @pcantrell pcantrell committed Jan 25, 2012
Showing with 4 additions and 1 deletion.
  1. +4 −1 lib/exception_notifier.rb
View
5 lib/exception_notifier.rb
@@ -27,6 +27,7 @@ def initialize(app, options = {})
@options[:ignore_exceptions] ||= self.class.default_ignore_exceptions
@options[:ignore_crawlers] ||= self.class.default_ignore_crawlers
+ @options[:ignore_if] ||= lambda { |e| false }
end
def call(env)
@@ -35,7 +36,9 @@ def call(env)
options = (env['exception_notifier.options'] ||= Notifier.default_options)
options.reverse_merge!(@options)
- unless ignored_exception(options[:ignore_exceptions], exception) || from_crawler(options[:ignore_crawlers], env['HTTP_USER_AGENT'])
+ unless ignored_exception(options[:ignore_exceptions], exception) ||
+ from_crawler(options[:ignore_crawlers], env['HTTP_USER_AGENT']) ||
+ options[:ignore_if].call(exception)
Notifier.exception_notification(env, exception).deliver
env['exception_notifier.delivered'] = true
end

0 comments on commit 7fe1a7f

Please sign in to comment.