[ruby-core:117105] [Ruby master Feature#13557] there's no way to pass backtrace locations as a massaged backtrace
From:
"ko1 (Koichi Sasada) via ruby-core" <ruby-core@...>
Date:
2024-03-12 04:28:03 UTC
List:
ruby-core #117105
Issue #13557 has been updated by ko1 (Koichi Sasada).
I'm not against but could you summarize usages?
----------------------------------------
Feature #13557: there's no way to pass backtrace locations as a massaged backtrace
https://bugs.ruby-lang.org/issues/13557#change-107179
* Author: sylvain.joyeux (Sylvain Joyeux)
* Status: Open
----------------------------------------
When re-raising exceptions, it is sometimes useful to "massage" the backtrace (especially in DSLs).
There is currently no way to do it using only backtrace locations. This causes the new exception to have #backtrace_locations return nil, and thus makes backtrace_locations unreliable as a whole.
Example:
~~~ruby
def test
raise ArgumentError, "", caller_locations
end
begin
test
rescue ArgumentError => e
p e.backtrace_locations
end
~~~
attempting to pass `caller_location` to `Kernel#raise` in the `test` method fails with ``bla.rb:2:in `set_backtrace': backtrace must be Array of String (TypeError)``
--
https://bugs.ruby-lang.org/
______________________________________________
ruby-core mailing list -- [email protected]
To unsubscribe send an email to [email protected]
ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/