New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fname information when eval fails due to SyntaxError #3698

i110 opened this Issue Jun 8, 2017 · 1 comment


None yet
1 participant

i110 commented Jun 8, 2017

When calling eval fails due to SyntaxError, currently the error message is like the following:

$ mruby -e 'eval("?", nil, "XXX.rb", 4)'

        [0] -e:1
-e:1: line 4: incomplete character syntax

As you can see, fname (XXX.rb) information has been stripped out. This makes it harder to debug the code, particularly when I use (which calls eval with fname internally) because I cannot find the problematic files from given error message, like the following:

$ mruby -e 'require "XXX"'

        [0] /Users/i110/mruby-require/mrblib/require.rb:7:in Object._require_eval_load
        [1] /Users/i110/mruby-require/mrblib/require.rb:23:in Kernel#load
        [2] /Users/i110/mruby-require/mrblib/require.rb:79:in Kernel#__require__
        [3] /Users/i110/mruby-require/mrblib/require.rb:64:in Kernel#require
        [4] -e:1
/Users/i110/mruby-require/mrblib/require.rb:7: line 1: invalid character syntax; use ?\n

IMHO it would be great if SyntaxError message could contain the fname information like CRuby, and like the code below:

How do you feel about it?

@matz matz closed this in d7e09ff Jun 15, 2017


This comment has been minimized.

Show comment
Hide comment

i110 Jun 16, 2017


thanks a lot!


i110 commented Jun 16, 2017

thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment