Skip to content

Commit

Permalink
repl: make 'Unexpected token' errors recoverable
Browse files Browse the repository at this point in the history
Fix the regexp used to detect 'Unexpected token' errors so that they can
be considered as recoverable. This fixes the following use case:

> var foo = 'bar \
... baz';
undefined
> foo
'bar baz'
>

Fixes nodejs#8874
  • Loading branch information
Julien Gilli committed Dec 15, 2014
1 parent 4bba870 commit 607e7b5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/repl.js
Original file line number Diff line number Diff line change
Expand Up @@ -949,7 +949,7 @@ REPLServer.prototype.convertToContext = function(cmd) {
function isRecoverableError(e) {
return e &&
e.name === 'SyntaxError' &&
/^(Unexpected end of input|Unexpected token :)/.test(e.message);
/^(Unexpected end of input|Unexpected token)/.test(e.message);
}

function Recoverable(err) {
Expand Down

0 comments on commit 607e7b5

Please sign in to comment.