Issue #8960 has been updated by Ryan Nevell.

Assignee changed from Koichi Sasada to 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:
~~~ ruby
rescue => e
  raise MyCustomException, "Error details", e.backtrace
~~~

But this is calling set_backtrace, leaving the resulting exception's backtrace_locations nil (on MRI 2.3.1) or [] (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.

----------------------------------------
Feature #8960: Add Exception#backtrace_locations
https://bugs.ruby-lang.org/issues/8960#change-60183

* Author: Charles Nutter
* Status: Feedback
* Priority: Normal
* Assignee: Charles Nutter
----------------------------------------
All parties agreed this would be useful to add in https://bugs.ruby-lang.org/issues/7895 and ko1 suggested I file a feature against ruby-trunk. So here it is.

I might be able to come up with a patch, but I'm not sure when. Help wanted.

Can we agree this will go into 2.1?



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>