Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

LH-470 Also unwrap exceptions which provide #continued_exception like…

… REXML::ParseError
  • Loading branch information...
commit f4a07ed31a012be858b9275c5a0a30dc0d444bfb 1 parent d00b73d
@jasonm jasonm authored
Showing with 20 additions and 1 deletion.
  1. +2 −1  lib/hoptoad_notifier.rb
  2. +18 −0 test/notifier_test.rb
View
3  lib/hoptoad_notifier.rb
@@ -139,10 +139,11 @@ def build_notice_for(exception, opts = {})
def unwrap_exception(exception)
if exception.respond_to?(:original_exception)
exception.original_exception
+ elsif exception.respond_to?(:continued_exception)
+ exception.continued_exception
else
exception
end
-
end
end
end
View
18 test/notifier_test.rb
@@ -5,6 +5,9 @@ class NotifierTest < Test::Unit::TestCase
class OriginalException < Exception
end
+ class ContinuedException < Exception
+ end
+
include DefinesConstants
def setup
@@ -200,5 +203,20 @@ def set_development_env
assert_equal "NotifierTest::OriginalException", @hash[:error_class]
end
end
+
+ context "when an exception that provides #continued_exception is raised" do
+ setup do
+ @exception.stubs(:continued_exception).returns(begin
+ raise NotifierTest::ContinuedException.new
+ rescue Exception => e
+ e
+ end)
+ end
+
+ should "unwrap exceptions that provide #continued_exception" do
+ @hash = HoptoadNotifier.build_lookup_hash_for(@exception)
+ assert_equal "NotifierTest::ContinuedException", @hash[:error_class]
+ end
+ end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.