From a33909e1074c91c468ce75df3979c244b1f7cc0f 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 b1e56b0fb5b70c..206fde66078f2c 100644 --- a/lib/repl.js +++ b/lib/repl.js @@ -1224,15 +1224,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; }