From 66e66e59a4ab7ecf90f38b2c415b3b2f79418377 Mon Sep 17 00:00:00 2001 From: Ali Ijaz Sheikh Date: Fri, 4 Mar 2016 14:13:13 -0800 Subject: [PATCH] repl: fix repl after V8 upgrade V8 improved the error message for illegal token in https://github.com/v8/v8/commit/879b617b. This breaks the recoverable error handling in repl. Ref: https://github.com/nodejs/node/pull/6482 PR-URL: https://github.com/nodejs/node/pull/7016 Reviewed-By: bnoordhuis - Ben Noordhuis --- lib/repl.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/lib/repl.js b/lib/repl.js index 672eab08668cfb..704992aabc12a9 100644 --- a/lib/repl.js +++ b/lib/repl.js @@ -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; }