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
The error message of SyntaxError is different from Ruby's one #2102
Comments
barrettkingram
pushed a commit
to barrettkingram/pry
that referenced
this issue
Mar 21, 2020
Previously when catching syntax errors in the REPL, we were only showing the last syntax error displayed by the ruby output. However, ruby can generate multiple syntax error messages within a single SyntaxException. For example, this code generates multiple syntax error messages: ``` $ ruby -e 'puts {"key"=>"val"}.to_json' -e:1: syntax error, unexpected =>, expecting '}' puts {"key"=>"val"}.to_json -e:1: syntax error, unexpected '}', expecting end-of-input puts {"key"=>"val"}.to_json ``` We can't predict which error message would be most helpful for the consumer - we should show both of them. This commit modifies the string replacement we're doing when printing SyntaxExceptions so any number of syntax error lines will be shown correctly. Issue: pry#2102 The error message of SyntaxError is different from Ruby's one
barrettkingram
pushed a commit
to barrettkingram/pry
that referenced
this issue
Mar 21, 2020
Previously when catching syntax errors in the REPL, we were only showing the last syntax error displayed by the ruby output. However, ruby can generate multiple syntax error messages within a single SyntaxException. For example, this code generates multiple syntax error messages: ``` $ ruby -e 'puts {"key"=>"val"}.to_json' -e:1: syntax error, unexpected =>, expecting '}' puts {"key"=>"val"}.to_json -e:1: syntax error, unexpected '}', expecting end-of-input puts {"key"=>"val"}.to_json ``` We can't predict which error message would be most helpful for the consumer - we should show both of them. This commit modifies the string replacement we're doing when printing SyntaxExceptions so any number of syntax error lines will be shown correctly. Issue: pry#2102 The error message of SyntaxError is different from Ruby's one
Looks like if a statement causes multiple |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The error message of
ruby -e
and irb containsunexpected =>
but pry's one doesn't.environment
The text was updated successfully, but these errors were encountered: