From 411097002bb91b27026f1ad4e019d641bb9cc637 Mon Sep 17 00:00:00 2001 From: Kenneth Myhra Date: Mon, 13 Feb 2023 20:54:55 +0100 Subject: [PATCH] LibWeb: Add a method to ExceptionOr to drop error handling This should solely be used to to ignore errors in infallible contexts. --- Userland/Libraries/LibWeb/WebIDL/ExceptionOr.h | 6 ++++++ 1 file changed, 6 insertions(+) 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(); } + 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, JS::Completion> release_error() { return exception(); }