improve usability (#5753)

This commit is contained in:
Alex Lam S.L
2022-12-02 04:14:07 +02:00
committed by GitHub
parent 59e385591c
commit 650e63c8aa
3 changed files with 17 additions and 4 deletions

View File

@@ -207,7 +207,11 @@ function JS_Parse_Error(message, filename, line, col, pos) {
this.line = line;
this.col = col;
this.pos = pos;
configure_error_stack(this, new SyntaxError(message, filename, line, col));
try {
throw new SyntaxError(message, filename, line, col);
} catch (cause) {
configure_error_stack(this, cause);
}
}
JS_Parse_Error.prototype = Object.create(SyntaxError.prototype);
JS_Parse_Error.prototype.constructor = JS_Parse_Error;