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

LibJS: Convert the GetValue AO to ThrowCompletionOr

This commit is contained in:
Idan Horowitz 2021-11-02 18:49:08 +02:00 committed by Linus Groh
parent d73b258874
commit 390a04a985
6 changed files with 33 additions and 49 deletions

View file

@ -65,9 +65,7 @@ TESTJS_GLOBAL_FUNCTION(mark_as_garbage, markAsGarbage)
auto reference = vm.resolve_binding(variable_name.string(), outer_environment.value()->lexical_environment);
auto value = reference.get_value(global_object);
if (auto* exception = vm.exception())
return JS::throw_completion(exception->value());
auto value = TRY(reference.get_value(global_object));
if (!value.is_object())
return vm.throw_completion<JS::TypeError>(global_object, JS::ErrorType::NotAnObject, String::formatted("Variable with name {}", variable_name.string()));