Skip to content

repl contains v8-specific syntax error message sniffs #21478

@jdalton

Description

@jdalton

There has been an effort to avoid engine specific error message sniffs.
In this case I spotted a few V8 specific sniffs in the repl.

node/lib/repl.js

Lines 1492 to 1505 in a40e062

var message = e.message;
if (message === 'Unterminated template literal' ||
message === 'Unexpected end of input') {
return true;
}
if (message === 'missing ) after argument list') {
const frames = e.stack.split(/\r?\n/);
const pos = frames.findIndex((f) => f.match(/^\s*\^+$/));
return pos > 0 && frames[pos - 1].length === frames[pos].length;
}
if (message === 'Invalid or unexpected token')
return isCodeRecoverable(code);

Metadata

Metadata

Assignees

No one assigned

    Labels

    replIssues and PRs related to the REPL subsystem.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions