summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth Myhra <kennethmyhra@gmail.com>2023-02-13 20:54:55 +0100
committerLinus Groh <mail@linusgroh.de>2023-02-18 00:52:47 +0100
commit411097002bb91b27026f1ad4e019d641bb9cc637 (patch)
tree582348342265f3a08ff9636df8c38e6036c07b9f
parent3a01573350296cc12a45786ddc4627beb90f39f1 (diff)
downloadserenity-411097002bb91b27026f1ad4e019d641bb9cc637.zip
LibWeb: Add a method to ExceptionOr to drop error handling
This should solely be used to to ignore errors in infallible contexts.
-rw-r--r--Userland/Libraries/LibWeb/WebIDL/ExceptionOr.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/WebIDL/ExceptionOr.h b/Userland/Libraries/LibWeb/WebIDL/ExceptionOr.h
index b27a506dcf..cb0eaa52d0 100644
--- a/Userland/Libraries/LibWeb/WebIDL/ExceptionOr.h
+++ b/Userland/Libraries/LibWeb/WebIDL/ExceptionOr.h
@@ -110,6 +110,12 @@ public:
return !m_exception.template has<Empty>();
}
+ ValueType release_value_but_fixme_should_propagate_errors()
+ {
+ VERIFY(!is_error());
+ return release_value();
+ }
+
// These are for compatibility with the TRY() macro in AK.
[[nodiscard]] bool is_error() const { return is_exception(); }
Variant<SimpleException, JS::NonnullGCPtr<DOMException>, JS::Completion> release_error() { return exception(); }