diff options
Diffstat (limited to 'Userland/Libraries/LibWeb/Bindings/ExceptionOrUtils.h')
-rw-r--r-- | Userland/Libraries/LibWeb/Bindings/ExceptionOrUtils.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/Userland/Libraries/LibWeb/Bindings/ExceptionOrUtils.h b/Userland/Libraries/LibWeb/Bindings/ExceptionOrUtils.h index 94d5bf62f1..eb089070af 100644 --- a/Userland/Libraries/LibWeb/Bindings/ExceptionOrUtils.h +++ b/Userland/Libraries/LibWeb/Bindings/ExceptionOrUtils.h @@ -24,7 +24,10 @@ template<typename T> ALWAYS_INLINE bool throw_dom_exception(JS::VM& vm, JS::GlobalObject& global_object, DOM::ExceptionOr<T>& result) { if (result.is_exception()) { - vm.throw_exception(global_object, DOMExceptionWrapper::create(global_object, const_cast<DOM::DOMException&>(result.exception()))); + result.materialized_exception(global_object) + .visit( + [&](NonnullRefPtr<DOM::DOMException> dom_exception) { vm.throw_exception(global_object, DOMExceptionWrapper::create(global_object, move(dom_exception))); }, + [&](auto* js_exception) { vm.throw_exception(global_object, js_exception); }); return true; } return false; @@ -48,6 +51,11 @@ struct ExtractExceptionOrValueType<void> { }; template<> +struct ExtractExceptionOrValueType<DOM::ExceptionOr<Empty>> { + using Type = JS::Value; +}; + +template<> struct ExtractExceptionOrValueType<DOM::ExceptionOr<void>> { using Type = JS::Value; }; |