Browse Source

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 <info@bnoordhuis.nl>
v7.x
Ali Ijaz Sheikh 9 years ago
committed by Michaël Zasso
parent
commit
a33909e107
No known key found for this signature in database GPG Key ID: 770F7A9A5AE15600
  1. 11
      lib/repl.js

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

Loading…
Cancel
Save