Bug #14229
closedAn exception in eval has strange message
Description
Is this intentional? If so, I'm curious what purpose it is for.
begin
eval("raise")
rescue
p e.message #=> "(eval):1:in `<main>'"
end
This leads to progressive backtrace message:
$ ./miniruby -e 'eval("raise")'
Traceback (most recent call last):
2: from -e:1:in `<main>'
1: from -e:1:in `eval'
-e:1:in `eval': (eval):1:in `<main>' (RuntimeError)
^^^^^^^^^^^^^^^^^^^^ HIGHLIGHTED
Updated by shevegen (Robert A. Heiler) almost 7 years ago
Is this only with miniruby?
I get "undefined local variable or method `e' for main:Object"
for a newly created "test.rb" file.
The e.message part confuses me, was this part of a larger code
snippet?
Updated by phluid61 (Matthew Kerwin) almost 7 years ago
shevegen (Robert A. Heiler) wrote:
I get "undefined local variable or method `e' for main:Object"
for a newly created "test.rb" file.The e.message part confuses me, was this part of a larger code
snippet?
begin
eval("raise")
rescue => e
p e.message
end
Updated by mame (Yusuke Endoh) almost 7 years ago
phluid61 (Matthew Kerwin) wrote:
shevegen (Robert A. Heiler) wrote:
I get "undefined local variable or method `e' for main:Object"
for a newly created "test.rb" file.
Sorry it was buggy. phluid61 is correct.
Updated by nobu (Nobuyoshi Nakada) almost 7 years ago
- Target version set to 2.6
I think I've filed this issue already (and discussed at a developers' meeting), but I can't remember the number.
Updated by nobu (Nobuyoshi Nakada) almost 7 years ago
- Related to Feature #12338: bypass Exception.new added
Updated by nobu (Nobuyoshi Nakada) almost 7 years ago
Updated by nobu (Nobuyoshi Nakada) almost 7 years ago
- Status changed from Assigned to Closed
Applied in changeset trunk|r61482.
vm_eval.c: strange message in eval
- vm_eval.c (eval_string_with_cref): remove unnecessary location
from exception backtrace in eval.
[ruby-core:84434] [Bug #14229]