diff --git a/Userland/Libraries/LibWeb/WebIDL/ExceptionOr.h b/Userland/Libraries/LibWeb/WebIDL/ExceptionOr.h index c771db12b0..9ce61493b6 100644 --- a/Userland/Libraries/LibWeb/WebIDL/ExceptionOr.h +++ b/Userland/Libraries/LibWeb/WebIDL/ExceptionOr.h @@ -50,6 +50,15 @@ public: { } + // Allows implicit construction of ExceptionOr from a type U if T(U) is a supported constructor. + // Most commonly: Value from Object* or similar, so we can omit the curly braces from "return { TRY(...) };". + // Disabled for POD types to avoid weird conversion shenanigans. + template + ExceptionOr(WrappedValueType result) requires(!IsPOD) + : m_result(move(result)) + { + } + ExceptionOr(JS::NonnullGCPtr exception) : m_exception(move(exception)) {