mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 19:07:34 +00:00
LibWeb: Add WebIDL::ExceptionOr constructor for wrapped ValueType
This is copied from JS::ThrowCompletionOr and will allow using them interchangeably with types wrapped by JS::Value such as JS::Object*.
This commit is contained in:
parent
4461234898
commit
426e32e5c0
1 changed files with 9 additions and 0 deletions
|
@ -50,6 +50,15 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
// Allows implicit construction of ExceptionOr<T> 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<typename WrappedValueType>
|
||||
ExceptionOr(WrappedValueType result) requires(!IsPOD<ValueType>)
|
||||
: m_result(move(result))
|
||||
{
|
||||
}
|
||||
|
||||
ExceptionOr(JS::NonnullGCPtr<DOMException> exception)
|
||||
: m_exception(move(exception))
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue