Actions
Bug #22129
closederror_highlight raises NotImplementedError for ArgumentErrors that get wrapped
Bug #22129:
error_highlight raises NotImplementedError for ArgumentErrors that get wrapped
Description
With code like
def x(y:) = y
begin
x
rescue => e
p e.exception("wat").detailed_message
end
a NotImplementedError is raised on ruby 4.0+
/Users/rwstauner/.rubies/4.0.2/lib/ruby/4.0.0/error_highlight/base.rb:297:in 'ErrorHighlight::Spotter#spot': NotImplementedError (NotImplementedError)
from /Users/rwstauner/.rubies/4.0.2/lib/ruby/4.0.0/error_highlight/base.rb:68:in 'ErrorHighlight.spot'
from /Users/rwstauner/.rubies/4.0.2/lib/ruby/4.0.0/error_highlight/core_ext.rb:34:in 'ErrorHighlight::CoreExt#generate_snippet'
from /Users/rwstauner/.rubies/4.0.2/lib/ruby/4.0.0/error_highlight/core_ext.rb:43:in 'ErrorHighlight::CoreExt#detailed_message'
from tiny.rb:6:in 'Exception#full_message'
from tiny.rb:6:in '<main>'
tiny.rb:1:in 'Object#x': missing keyword: :y (ArgumentError)
caller: tiny.rb:4
| x
^
callee: tiny.rb:1
| def x(y:) = y
^
from tiny.rb:4:in '<main>'
on ruby 3.4 it did not raise:
tiny.rb:1:in 'x': wat (ArgumentError)
from tiny.rb:4:in '<main>'
seems related to https://bugs.ruby-lang.org/issues/21543
I have a PR up at https://github.com/ruby/error_highlight/pull/78
Updated by rwstauner (Randy Stauner) 1 day ago
- Description updated (diff)
Updated by hsbt (Hiroshi SHIBATA) about 18 hours ago
- Status changed from Open to Assigned
- Assignee set to mame (Yusuke Endoh)
Updated by mame (Yusuke Endoh) about 15 hours ago
- Status changed from Assigned to Closed
Merged, thank you!
Updated by rwstauner (Randy Stauner) about 4 hours ago
Backport PR for 4.0: https://github.com/ruby/ruby/pull/17480
Actions