Skip to content

Commit ad135e9

Browse files
committed
- Fixed marshalling of specs if they error. (tenderlove, jeremyevans, et al)
[git-p4: depot-paths = "//src/minitest/dev/": change = 13285]
1 parent fee0bb0 commit ad135e9

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

lib/minitest/test.rb

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,17 @@ def capture_exceptions # :nodoc:
198198
rescue Assertion => e
199199
self.failures << e
200200
rescue Exception => e
201-
self.failures << UnexpectedError.new(e)
201+
self.failures << UnexpectedError.new(sanitize_exception e)
202+
end
203+
204+
def sanitize_exception e # :nodoc:
205+
Marshal.dump e
206+
e
207+
rescue TypeError
208+
bt = e.backtrace
209+
e = RuntimeError.new "Wrapped undumpable exception for: #{e.class}: #{e.message}"
210+
e.set_backtrace bt
211+
e
202212
end
203213

204214
def with_info_handler &block # :nodoc:

0 commit comments

Comments
 (0)