Project

General

Profile

Bug #22129

Updated by rwstauner (Randy Stauner) 4 months ago

With code like 

 ```ruby 
 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 ```/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

Back