Skip to content
This repository has been archived by the owner on Nov 11, 2017. It is now read-only.

Commit

Permalink
Revert "handles exceptions with #to_hash properly"
Browse files Browse the repository at this point in the history
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
Harold Giménez committed Aug 24, 2011
1 parent 73a1570 commit 4d2fa3f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 15 deletions.
7 changes: 5 additions & 2 deletions lib/airbrake.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
13 changes: 0 additions & 13 deletions test/notifier_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4d2fa3f

Please sign in to comment.