summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/DOM
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2022-03-22 12:37:19 +0000
committerLinus Groh <mail@linusgroh.de>2022-03-22 18:05:25 +0000
commit91d0088a5b73e0c880591431ecbc6772011dc799 (patch)
tree5ac827592d6f94346938c5dadd4c42074713fa16 /Userland/Libraries/LibWeb/DOM
parente758bd303f8e4bf439510052c4bbaef49773dc95 (diff)
downloadserenity-91d0088a5b73e0c880591431ecbc6772011dc799.zip
LibWeb: Convert DOMImplementation to use TRY for error propagation
Diffstat (limited to 'Userland/Libraries/LibWeb/DOM')
-rw-r--r--Userland/Libraries/LibWeb/DOM/DOMImplementation.cpp12
1 files changed, 3 insertions, 9 deletions
diff --git a/Userland/Libraries/LibWeb/DOM/DOMImplementation.cpp b/Userland/Libraries/LibWeb/DOM/DOMImplementation.cpp
index 28a5a11dbd..08ae8d5de2 100644
--- a/Userland/Libraries/LibWeb/DOM/DOMImplementation.cpp
+++ b/Userland/Libraries/LibWeb/DOM/DOMImplementation.cpp
@@ -29,12 +29,8 @@ ExceptionOr<NonnullRefPtr<Document>> DOMImplementation::create_document(const St
RefPtr<Element> element;
- if (!qualified_name.is_empty()) {
- auto new_element = xml_document->create_element_ns(namespace_, qualified_name /* FIXME: and an empty dictionary */);
- if (new_element.is_exception())
- return new_element.exception();
- element = new_element.release_value();
- }
+ if (!qualified_name.is_empty())
+ element = TRY(xml_document->create_element_ns(namespace_, qualified_name /* FIXME: and an empty dictionary */));
if (doctype)
xml_document->append_child(doctype.release_nonnull());
@@ -92,9 +88,7 @@ NonnullRefPtr<Document> DOMImplementation::create_html_document(const String& ti
// https://dom.spec.whatwg.org/#dom-domimplementation-createdocumenttype
ExceptionOr<NonnullRefPtr<DocumentType>> DOMImplementation::create_document_type(String const& qualified_name, String const& public_id, String const& system_id)
{
- auto result = Document::validate_qualified_name(qualified_name);
- if (result.is_exception())
- return result.exception();
+ TRY(Document::validate_qualified_name(qualified_name));
auto document_type = DocumentType::create(document());
document_type->set_name(qualified_name);
document_type->set_public_id(public_id);