1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 15:17:36 +00:00

LibWeb: Support plain (throw) JS::Completion in WebIDL::ExceptionOr

This makes it possible to propagate exceptions from a function that
returns JS::ThrowCompletionOr via TRY() in another function that returns
WebIDL::ExceptionOr.
This commit is contained in:
Linus Groh 2022-09-25 17:52:27 +01:00
parent b9d626d6b2
commit 4461234898
2 changed files with 20 additions and 7 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, the SerenityOS developers.
* Copyright (c) 2021-2022, the SerenityOS developers.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@ -75,6 +75,9 @@ ALWAYS_INLINE JS::Completion dom_exception_to_throw_completion(auto&& vm, auto&&
},
[&](JS::NonnullGCPtr<WebIDL::DOMException> const& exception) {
return throw_completion(exception);
},
[&](JS::Completion const& completion) {
return completion;
});
}