Project

General

Profile

Actions

Bug #22129

closed

error_highlight raises NotImplementedError for ArgumentErrors that get wrapped

Bug #22129: error_highlight raises NotImplementedError for ArgumentErrors that get wrapped

Added by rwstauner (Randy Stauner) 1 day ago. Updated about 4 hours ago.

Status:
Closed
Target version:
-
[ruby-core:125833]

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 Actions #1

  • Description updated (diff)

Updated by hsbt (Hiroshi SHIBATA) about 18 hours ago Actions #2

  • Status changed from Open to Assigned
  • Assignee set to mame (Yusuke Endoh)

Updated by mame (Yusuke Endoh) about 15 hours ago Actions #3 [ruby-core:125835]

  • Status changed from Assigned to Closed

Merged, thank you!

Actions

Also available in: PDF Atom