Issue #14229 has been updated by shevegen (Robert A. Heiler).


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?

----------------------------------------
Bug #14229: An exception in eval has strange message
https://bugs.ruby-lang.org/issues/14229#change-68640

* Author: mame (Yusuke Endoh)
* Status: Assigned
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version: next minor
* ruby -v: 
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN
----------------------------------------
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



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>