From 1639ed7e0a9bc063599ec193b7b6af48f7d5faba Mon Sep 17 00:00:00 2001 From: Idan Horowitz Date: Sat, 16 Oct 2021 22:11:08 +0300 Subject: LibJS: Convert to_double() to ThrowCompletionOr --- Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'Userland/Libraries/LibWeb/WebAssembly') diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp index 4fbfddbec9..2b49e3b74d 100644 --- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp +++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp @@ -403,15 +403,11 @@ Optional to_webassembly_value(JS::Value value, const Wasm::ValueTyp return Wasm::Value { static_cast(_i32) }; } case Wasm::ValueType::F64: { - auto number = value.to_double(global_object); - if (vm.exception()) - return {}; + auto number = TRY_OR_DISCARD(value.to_double(global_object)); return Wasm::Value { static_cast(number) }; } case Wasm::ValueType::F32: { - auto number = value.to_double(global_object); - if (vm.exception()) - return {}; + auto number = TRY_OR_DISCARD(value.to_double(global_object)); return Wasm::Value { static_cast(number) }; } case Wasm::ValueType::FunctionReference: -- cgit v1.2.3