1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 09:47:35 +00:00

LibWeb: Add a method to ExceptionOr to drop error handling

This should solely be used to to ignore errors in infallible contexts.
This commit is contained in:
Kenneth Myhra 2023-02-13 20:54:55 +01:00 committed by Linus Groh
parent 3a01573350
commit 411097002b

View file

@ -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(); }