Skip to content

Commit

Permalink
repl: fix repl after V8 upgrade
Browse files Browse the repository at this point in the history
V8 improved the error message for illegal token in
v8/v8@879b617b. This breaks the recoverable
error handling in repl.

Ref: #6482

PR-URL: #7016
Reviewed-By: bnoordhuis - Ben Noordhuis <info@bnoordhuis.nl>
  • Loading branch information
ofrobots committed Aug 25, 2016
1 parent a91f6b8 commit 66e66e5
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions lib/repl.js
Original file line number Diff line number Diff line change
Expand Up @@ -1361,15 +1361,12 @@ function isRecoverableError(e, self) {
}

if (message.startsWith('Unexpected end of input') ||
message.startsWith('missing ) after argument list'))
message.startsWith('missing ) after argument list') ||
message.startsWith('Unexpected token'))
return true;

if (message.startsWith('Unexpected token')) {
if (message.includes('ILLEGAL') && bailOnIllegalToken(self.lineParser))
return false;
else
return true;
}
if (message === 'Invalid or unexpected token')
return !bailOnIllegalToken(self.lineParser);
}
return false;
}
Expand Down

1 comment on commit 66e66e5

@Fishrock123
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm, makes me a bit nervous.

Please sign in to comment.