diff options
author | Kenneth Myhra <kennethmyhra@gmail.com> | 2023-02-13 20:54:55 +0100 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2023-02-18 00:52:47 +0100 |
commit | 411097002bb91b27026f1ad4e019d641bb9cc637 (patch) | |
tree | 582348342265f3a08ff9636df8c38e6036c07b9f /Userland/Libraries/LibWeb/WebIDL/ExceptionOr.h | |
parent | 3a01573350296cc12a45786ddc4627beb90f39f1 (diff) | |
download | serenity-411097002bb91b27026f1ad4e019d641bb9cc637.zip |
LibWeb: Add a method to ExceptionOr to drop error handling
This should solely be used to to ignore errors in infallible contexts.
Diffstat (limited to 'Userland/Libraries/LibWeb/WebIDL/ExceptionOr.h')
-rw-r--r-- | Userland/Libraries/LibWeb/WebIDL/ExceptionOr.h | 6 |
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(); } |