1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:18:13 +00:00

LibWeb: Make ExceptionOr capable of holding all error types in the spec

The WebIDL spec specifies a few "simple" exception types in addition to
the DOMException type, let's support all of those.
This allows functions returning ExceptionOr<T> to throw regular
javascript exceptions (as limited by the webidl spec) by returning a
`DOM::SimpleException { DOM::SimpleExceptionType::T, "error message" }`
which is pretty damn cool :^)
This commit is contained in:
Ali Mohammad Pur 2021-06-27 00:17:13 +04:30 committed by Linus Groh
parent bda19a9ff3
commit fd72597999
4 changed files with 77 additions and 35 deletions

View file

@ -267,7 +267,7 @@ ExceptionOr<NonnullRefPtr<Node>> Node::pre_insert(NonnullRefPtr<Node> node, RefP
{
auto validity_result = ensure_pre_insertion_validity(node, child);
if (validity_result.is_exception())
return NonnullRefPtr<DOMException>(validity_result.exception());
return validity_result.exception();
auto reference_child = child;
if (reference_child == node)