Permalink
Browse files

Log ignored exceptions

  • Loading branch information...
1 parent 3a982f2 commit 7e24aaced74a1d4c8bd4455b55b5e8110f2a4457 @rsanheim committed Dec 17, 2009
@@ -27,6 +27,18 @@
Chatterbox::ExceptionNotification.handle(:exception => RuntimeError.new).should be_nil
end
+ it "logs the ignore" do
+ Chatterbox::ExceptionNotification.configure { |c| c.ignore << RuntimeError }
+ Chatterbox.logger.expects(:debug).once
+ Chatterbox::ExceptionNotification.handle(RuntimeError.new)
+ end
+ end
+
+ describe "when not on ignore list" do
+ it "logs nothing" do
+ Chatterbox.logger.expects(:debug).never
+ Chatterbox::ExceptionNotification.handle(:exception => Exception.new)
+ end
end
end
@@ -27,8 +27,14 @@ def normalize_to_hash(args)
end
def on_ignore_list?(exception)
- configuration.ignore.include?(exception.class) ||
- configuration.ignore.include?(exception.class.to_s)
+ ignored = configuration.ignore.include?(exception.class) ||
+ configuration.ignore.include?(exception.class.to_s)
+ log_ignored_exception(exception) if ignored
+ ignored
+ end
+
+ def log_ignored_exception(exception)
+ Chatterbox.logger.debug { "Chatterbox::ExceptionNotification ignoring exception: #{exception} as its on the ignore list"}
end
def configuration

0 comments on commit 7e24aac

Please sign in to comment.