Skip to content

Commit

Permalink
- Fixed marshalling of specs if they error. (tenderlove, jeremyevans,…
Browse files Browse the repository at this point in the history
… et al)

[git-p4: depot-paths = "//src/minitest/dev/": change = 13285]
  • Loading branch information
zenspider committed Dec 14, 2021
1 parent fee0bb0 commit ad135e9
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lib/minitest/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,17 @@ def capture_exceptions # :nodoc:
rescue Assertion => e
self.failures << e
rescue Exception => e
self.failures << UnexpectedError.new(e)
self.failures << UnexpectedError.new(sanitize_exception e)
end

def sanitize_exception e # :nodoc:
Marshal.dump e
e
rescue TypeError
bt = e.backtrace
e = RuntimeError.new "Wrapped undumpable exception for: #{e.class}: #{e.message}"
e.set_backtrace bt
e
end

def with_info_handler &block # :nodoc:
Expand Down

0 comments on commit ad135e9

Please sign in to comment.