Skip to content

Commit 2564ea5

Browse files
committed
Fix Exception#full_message when given cause with empty backtrace
The issue leads to the following error: ``` NameError: undefined local variable or method `exception' for module Truffle::ExceptionOperations <internal:core> core/truffle/exception_operations.rb:319:in `append_causes' <internal:core> core/truffle/exception_operations.rb:270:in `full_message' <internal:core> core/exception.rb:81:in `full_message' ```
1 parent a261478 commit 2564ea5

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

core/exception/full_message_spec.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,4 +211,16 @@ class << e
211211
e.full_message(highlight: false).lines.first.should =~ /RuntimeError/
212212
e.full_message(highlight: true).lines.first.should =~ /#{Regexp.escape("\e[1;4mRuntimeError\e[m")}/
213213
end
214+
215+
it "allows cause with empty backtrace" do
216+
begin
217+
raise RuntimeError.new("Some runtime error"), cause: RuntimeError.new("Some other runtime error")
218+
rescue => e
219+
end
220+
221+
full_message = e.full_message
222+
full_message.should include "RuntimeError"
223+
full_message.should include "Some runtime error"
224+
full_message.should include "Some other runtime error"
225+
end
214226
end

0 commit comments

Comments
 (0)