Skip to content

Commit a33909e

Browse files
ofrobotstargos
authored andcommitted
repl: fix repl after V8 upgrade
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 <[email protected]>
1 parent 6dfa533 commit a33909e

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

lib/repl.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1224,15 +1224,12 @@ function isRecoverableError(e, self) {
12241224
}
12251225

12261226
if (message.startsWith('Unexpected end of input') ||
1227-
message.startsWith('missing ) after argument list'))
1227+
message.startsWith('missing ) after argument list') ||
1228+
message.startsWith('Unexpected token'))
12281229
return true;
12291230

1230-
if (message.startsWith('Unexpected token')) {
1231-
if (message.includes('ILLEGAL') && bailOnIllegalToken(self.lineParser))
1232-
return false;
1233-
else
1234-
return true;
1235-
}
1231+
if (message === 'Invalid or unexpected token')
1232+
return !bailOnIllegalToken(self.lineParser);
12361233
}
12371234
return false;
12381235
}

0 commit comments

Comments
 (0)