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

LibJS: Convert Value::invoke and VM::call to ThrowCompletionOr

This commit is contained in:
Idan Horowitz 2021-09-23 20:56:28 +03:00
parent a90107b02a
commit ab594e5f2f
35 changed files with 196 additions and 328 deletions

View file

@ -113,9 +113,7 @@ static Value perform_promise_common(GlobalObject& global_object, Object& iterato
values->values().append(js_undefined());
auto next_promise = vm.call(promise_resolve.as_function(), constructor, next_value);
if (vm.exception())
return {};
auto next_promise = TRY_OR_DISCARD(vm.call(promise_resolve.as_function(), constructor, next_value));
++remaining_elements_count->value;
@ -410,7 +408,7 @@ JS_DEFINE_NATIVE_FUNCTION(PromiseConstructor::reject)
if (vm.exception())
return {};
auto reason = vm.argument(0);
[[maybe_unused]] auto result = vm.call(*promise_capability.reject, js_undefined(), reason);
[[maybe_unused]] auto result = TRY_OR_DISCARD(vm.call(*promise_capability.reject, js_undefined(), reason));
return promise_capability.promise;
}