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; }