Skip to content

repl contains v8-specific syntax error message sniffs #21478

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

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    replIssues and PRs related to the REPL subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions