mirror of
https://github.com/DoneJS-Runtime/quickjs-done-nextgen.git
synced 2025-01-09 17:43:15 +00:00
Fix catching all exceptions from std.evalScript
In case of a syntax error, the function throws syncrnonously. I'll admit I wondered when Promise.try would be useful... I guess I know now! Fixes: https://github.com/quickjs-ng/quickjs/issues/720#issuecomment-2495961142
This commit is contained in:
parent
61dae5d420
commit
9631492534
2 changed files with 21 additions and 22 deletions
BIN
gen/repl.c
BIN
gen/repl.c
Binary file not shown.
3
repl.js
3
repl.js
|
@ -1561,8 +1561,7 @@ import * as bjson from "qjs:bjson";
|
|||
expr = '"use strict"; void 0;' + expr;
|
||||
eval_start_time = os.now();
|
||||
/* eval as a script */
|
||||
result = std.evalScript(expr, { backtrace_barrier: true, async: true });
|
||||
/* result is a promise */
|
||||
result = Promise.try(std.evalScript, expr, { backtrace_barrier: true, async: true });
|
||||
result.then(print_eval_result, print_eval_error);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue