1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-19 00:25:07 +00:00

LibJS + js: Rethrow exception on the vm after bytecode interpreter run

When the bytecode interpreter was converted to ThrowCompletionOr<Value>
it then also cleared the vm.exception() making it seem like no exception
was thrown.
Also removed the TRY_OR_DISCARD as that would skip the error handling
parts.
This commit is contained in:
davidot 2021-11-17 13:00:38 +01:00 committed by Linus Groh
parent 3666d2132b
commit 22e679d844
2 changed files with 9 additions and 2 deletions

View file

@ -769,7 +769,11 @@ Completion ECMAScriptFunctionObject::ordinary_call_evaluate_body()
return throw_completion(exception->value());
VERIFY(result_and_frame.frame != nullptr);
auto result = TRY(result_and_frame.value);
if (result_and_frame.value.is_error()) {
vm.throw_exception(bytecode_interpreter->global_object(), result_and_frame.value.release_error().value());
return throw_completion(vm.exception()->value());
}
auto result = result_and_frame.value.release_value();
// NOTE: Running the bytecode should eventually return a completion.
// Until it does, we assume "return" and include the undefined fallback from the call site.