This issue was solved with changeset r44170.
Charles, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
error.c: add Exception#backtrace_locations.
Now, there are no setter and independent from Exception#backtrace.
[Feature #8960]
eval.c (setup_exception): set backtrace locations for `bt_location'
special attribute.
ko1: I have no problem whatsoever with backtrace_locations being read-only now and forever. I'm glad to see this made it into 2.1 as at least a basic feature.
Assignee changed from ko1 (Koichi Sasada) to headius (Charles Nutter)
Is there any way to re-raise an exception and propagate backtrace_locations? When I want to trap an exception and provide a different exception class and error message, I'm used to doing something like:
But this is calling set_backtrace, leaving the resulting exception's backtrace_locations nil (on MRI 2.3.1) or and empty array (on jruby 9.1.2.0).
If only some exceptions will have a valid backtrace_locations array (matching the information in backtrace), it is difficult to write code that takes advantage of this feature.
Is there any way to re-raise an exception and propagate backtrace_locations? When I want to trap an exception and provide a different exception class and error message, I'm used to doing something like:
Nothing right now.
If only some exceptions will have a valid backtrace_locations array (matching the information in backtrace), it is difficult to write code that takes advantage of this feature.