An exception in eval has strange message
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 phluid61 (Matthew Kerwin) over 3 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
begin eval("raise") rescue => e p e.message end
Updated by nobu (Nobuyoshi Nakada) over 3 years ago
- Status changed from Assigned to Closed