Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Display all syntax error messages when catching SyntaxException
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: #2102 The error message of SyntaxError is different from Ruby's one
- Loading branch information