diff --git a/Userland/Libraries/LibWeb/Bindings/ExceptionOrUtils.h b/Userland/Libraries/LibWeb/Bindings/ExceptionOrUtils.h index ab0b4879e83..61e7f942640 100644 --- a/Userland/Libraries/LibWeb/Bindings/ExceptionOrUtils.h +++ b/Userland/Libraries/LibWeb/Bindings/ExceptionOrUtils.h @@ -56,6 +56,8 @@ struct ExtractExceptionOrValueType> { using Type = JS::Value; }; +} + ALWAYS_INLINE JS::Completion dom_exception_to_throw_completion(JS::VM& vm, auto&& exception) { return exception.visit( @@ -81,8 +83,6 @@ ALWAYS_INLINE JS::Completion dom_exception_to_throw_completion(JS::VM& vm, auto& }); } -} - template using ExtractExceptionOrValueType = typename Detail::ExtractExceptionOrValueType::Type; @@ -97,7 +97,7 @@ JS::ThrowCompletionOr throw_dom_exception_if_needed(JS::VM& vm, F&& fn) auto&& result = fn(); if (result.is_exception()) - return Detail::dom_exception_to_throw_completion(vm, result.exception()); + return dom_exception_to_throw_completion(vm, result.exception()); if constexpr (requires(T v) { v.value(); }) return result.value(); diff --git a/Userland/Libraries/LibWeb/Fetch/FetchMethod.cpp b/Userland/Libraries/LibWeb/Fetch/FetchMethod.cpp index db54bf73ed2..0a5b4a7e352 100644 --- a/Userland/Libraries/LibWeb/Fetch/FetchMethod.cpp +++ b/Userland/Libraries/LibWeb/Fetch/FetchMethod.cpp @@ -36,8 +36,7 @@ JS::NonnullGCPtr fetch(JS::VM& vm, RequestInfo const& input, Reques // as arguments. If this throws an exception, reject p with it and return p. auto exception_or_request_object = Request::construct_impl(realm, input, init); if (exception_or_request_object.is_exception()) { - // FIXME: We should probably make this a public API? - auto throw_completion = Bindings::Detail::dom_exception_to_throw_completion(vm, exception_or_request_object.release_error()); + auto throw_completion = Bindings::dom_exception_to_throw_completion(vm, exception_or_request_object.exception()); WebIDL::reject_promise(realm, promise_capability, *throw_completion.value()); return verify_cast(*promise_capability->promise().ptr()); }