mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-11 18:20:43 +09:00
js: Create throw completions instead of raw error values on SyntaxError
This ensures that js's error printing logic is used instead of the generic value printing logic, which then lets eshost correctly parse thrown SyntaxErrors using the normal LibJS exception format.
This commit is contained in:
parent
a67a7229f8
commit
610afb21ac
Notes:
sideshowbarker
2024-07-17 10:29:01 +09:00
Author: https://github.com/IdanHo
Commit: 610afb21ac
Pull-request: https://github.com/SerenityOS/serenity/pull/14175
Reviewed-by: https://github.com/linusg ✅
1 changed files with 2 additions and 2 deletions
|
@ -1110,7 +1110,7 @@ static bool parse_and_run(JS::Interpreter& interpreter, StringView source, Strin
|
|||
if (!hint.is_empty())
|
||||
outln("{}", hint);
|
||||
outln(error.to_string());
|
||||
result = JS::SyntaxError::create(interpreter.global_object(), error.to_string());
|
||||
result = interpreter.vm().throw_completion<JS::SyntaxError>(interpreter.global_object(), error.to_string());
|
||||
} else {
|
||||
auto return_early = run_script_or_module(script_or_error.value());
|
||||
if (return_early == ReturnEarly::Yes)
|
||||
|
@ -1124,7 +1124,7 @@ static bool parse_and_run(JS::Interpreter& interpreter, StringView source, Strin
|
|||
if (!hint.is_empty())
|
||||
outln("{}", hint);
|
||||
outln(error.to_string());
|
||||
result = JS::SyntaxError::create(interpreter.global_object(), error.to_string());
|
||||
result = interpreter.vm().throw_completion<JS::SyntaxError>(interpreter.global_object(), error.to_string());
|
||||
} else {
|
||||
auto return_early = run_script_or_module(module_or_error.value());
|
||||
if (return_early == ReturnEarly::Yes)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue