Permalink
Browse files

Merge pull request #42 from Playhem/fix-issue-34-cherrypicked

Fix issue #34 (undefined method backtrace for Hash)
  • Loading branch information...
2 parents 3f7d3be + ae4d6aa commit c9f50730a642bf1d0b475d9f272bd1dfb4ba6964 @dvdplm dvdplm committed Dec 2, 2011
Showing with 12 additions and 1 deletion.
  1. +1 −1 lib/airbrake.rb
  2. +11 −0 test/notifier_test.rb
View
@@ -137,7 +137,7 @@ def send_notice(notice)
def build_notice_for(exception, opts = {})
exception = unwrap_exception(exception)
- opts = opts.merge(:exception => exception)
+ opts = opts.merge(:exception => exception) if exception.is_a?(Exception)
opts = opts.merge(exception.to_hash) if exception.respond_to?(:to_hash)
Notice.new(configuration.merge(opts))
end
View
@@ -82,6 +82,17 @@ def set_development_env
assert_sent(notice, notice_args)
end
+ should "not pass the hash as an exception when sending a notice for it" do
+ set_public_env
+ notice = stub_notice!
+ notice_args = { :error_message => 'uh oh' }
+ stub_sender!
+
+ Airbrake.notify(notice_args)
+
+ assert_received(Airbrake::Notice, :new) {|expect| expect.with(Not(has_key(:exception))) }
+ end
+
should "create and send a notice for an exception that responds to to_hash" do
set_public_env
exception = build_exception

0 comments on commit c9f5073

Please sign in to comment.