Bug #19065
closed
ruby 3.1.2 is printing all class variables for undefined error
Added by Varun (Sai Varun) about 2 years ago.
Updated about 2 years ago.
Description
Not sure whether this is a bug or some config issue from my side
Files
- Status changed from Open to Feedback
We need how to reproduce the issue and error output at least.
My bad
I have used the command "ruby script"
In the error message, we are getting all the class variables printed
We load a few files into the class variables and this issue is causing a bit of trouble for us.
Please check it once
- Is duplicate of Feature #18285: NoMethodError#message uses a lot of CPU/is really expensive to call added
- Status changed from Feedback to Closed
I think this is a duplicate of #18285.
Since Ruby 3.0.0, an error message of UndefinedMethod always includes all instance variables. As this could be too long as you said, it is reconsidered in #18285.
$ ./bin/ruby-2.7.6 -e 'class Foo; def initialize; @aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = 1; end; end; Foo.new.boo'
Traceback (most recent call last):
-e:1:in `<main>': undefined method `boo' for #<Foo:0x000055f12b8e94b0> (NoMethodError)
$ ./bin/ruby-3.0.0 -e 'class Foo; def initialize; @aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = 1; end; end; Foo.new.boo'
-e:1:in `<main>': undefined method `boo' for #<Foo:0x0000559d6e0b5de0 @aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa=1> (NoMethodError)
Also available in: Atom
PDF
Like0
Like0Like0Like0Like0Like0