Skip to content

Commit

Permalink
Merge pull request airbrake#271 from rykov/master
Browse files Browse the repository at this point in the history
Keep passed exception if original_exception is nil
  • Loading branch information
shifi committed Jul 28, 2014
2 parents f6d64c6 + 2cc8e8d commit 6401d52
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
4 changes: 1 addition & 3 deletions lib/airbrake.rb
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,7 @@ def unwrap_exception(exception)
exception.original_exception
elsif exception.respond_to?(:continued_exception)
exception.continued_exception
else
exception
end
end || exception
end
end
end
12 changes: 12 additions & 0 deletions test/notifier_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,12 @@ def set_development_env
@hash = Airbrake.build_lookup_hash_for(@exception)
assert_equal "NotifierTest::OriginalException", @hash[:error_class]
end

should "keep exception if #original_exception is nil" do
@exception.stubs(:original_exception).returns(nil)
@hash = Airbrake.build_lookup_hash_for(@exception)
assert_equal "BacktracedException", @hash[:error_class]
end
end

context "when an exception that provides #continued_exception is raised" do
Expand All @@ -271,6 +277,12 @@ def set_development_env
@hash = Airbrake.build_lookup_hash_for(@exception)
assert_equal "NotifierTest::ContinuedException", @hash[:error_class]
end

should "keep exception if #continued_exception is nil" do
@exception.stubs(:continued_exception).returns(nil)
@hash = Airbrake.build_lookup_hash_for(@exception)
assert_equal "BacktracedException", @hash[:error_class]
end
end
end
end

0 comments on commit 6401d52

Please sign in to comment.