mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-10 10:09:14 +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:
parent
bda19a9ff3
commit
fd72597999
Notes:
sideshowbarker
2024-07-18 11:27:42 +09:00
Author: https://github.com/alimpfard
Commit: fd72597999
Pull-request: https://github.com/SerenityOS/serenity/pull/8264
Reviewed-by: https://github.com/Lubrsi ✅
4 changed files with 77 additions and 35 deletions
|
@ -224,7 +224,7 @@ ExceptionOr<void> Document::set_body(HTML::HTMLElement& new_body)
|
|||
if (existing_body) {
|
||||
auto replace_result = existing_body->parent()->replace_child(new_body, *existing_body);
|
||||
if (replace_result.is_exception())
|
||||
return NonnullRefPtr<DOMException>(replace_result.exception());
|
||||
return replace_result.exception();
|
||||
return {};
|
||||
}
|
||||
|
||||
|
@ -234,7 +234,7 @@ ExceptionOr<void> Document::set_body(HTML::HTMLElement& new_body)
|
|||
|
||||
auto append_result = document_element->append_child(new_body);
|
||||
if (append_result.is_exception())
|
||||
return NonnullRefPtr<DOMException>(append_result.exception());
|
||||
return append_result.exception();
|
||||
return {};
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue