diff options
author | Idan Horowitz <idan.horowitz@gmail.com> | 2021-09-23 20:56:28 +0300 |
---|---|---|
committer | Idan Horowitz <idan.horowitz@gmail.com> | 2021-09-23 23:59:13 +0300 |
commit | ab594e5f2f60af7301d4a9e138d113389b25d40d (patch) | |
tree | d25f095a4881fb1cd82110e1c083279411b30fa7 /Userland/Libraries/LibJS/Runtime/PromiseConstructor.cpp | |
parent | a90107b02a4e8501593b582da2fe46cad123b372 (diff) | |
download | serenity-ab594e5f2f60af7301d4a9e138d113389b25d40d.zip |
LibJS: Convert Value::invoke and VM::call to ThrowCompletionOr
Diffstat (limited to 'Userland/Libraries/LibJS/Runtime/PromiseConstructor.cpp')
-rw-r--r-- | Userland/Libraries/LibJS/Runtime/PromiseConstructor.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/PromiseConstructor.cpp b/Userland/Libraries/LibJS/Runtime/PromiseConstructor.cpp index 630afddb29..8fc64ade9f 100644 --- a/Userland/Libraries/LibJS/Runtime/PromiseConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/PromiseConstructor.cpp @@ -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; } |