Skip to content
Browse files

Revert "handles exceptions with #to_hash properly"

This reverts commit 1b65dd7.

This commit is being reverted because the :exception key on the argument
to Notice.new is no longer an Exception decendant. As part of this
change, Notice needs to be reworked to handle that, or preferably never
instanciate a notice where the :exception key on the args is not an
Exception object.

Conflicts:

	test/notifier_test.rb
  • Loading branch information...
1 parent 73a1570 commit 4d2fa3f2ab438deced5e8de9dcabf485aa3d2827 Harold Giménez committed Aug 24, 2011
Showing with 5 additions and 15 deletions.
  1. +5 −2 lib/airbrake.rb
  2. +0 −13 test/notifier_test.rb
View
7 lib/airbrake.rb
@@ -132,8 +132,11 @@ def send_notice(notice)
def build_notice_for(exception, opts = {})
exception = unwrap_exception(exception)
- opts = opts.merge(:exception => exception)
- opts = opts.merge(exception.to_hash) if exception.respond_to?(:to_hash)
+ if exception.respond_to?(:to_hash)
+ opts = opts.merge(exception.to_hash)
+ else
+ opts = opts.merge(:exception => exception)
+ end
Notice.new(configuration.merge(opts))
end
View
13 test/notifier_test.rb
@@ -82,19 +82,6 @@ def set_development_env
assert_sent(notice, notice_args)
end
- should "create and send a notice for an exception that responds to to_hash" do
- set_public_env
- exception = build_exception
- notice = stub_notice!
- notice_args = { :error_message => 'uh oh' }
- exception.stubs(:to_hash).returns(notice_args)
- stub_sender!
-
- Airbrake.notify(exception)
-
- assert_sent(notice, notice_args.merge(:exception => exception))
- end
-
should "create and sent a notice for an exception and hash" do
set_public_env
exception = build_exception

0 comments on commit 4d2fa3f

Please sign in to comment.
Something went wrong with that request. Please try again.