diff options
author | Idan Horowitz <idan.horowitz@gmail.com> | 2021-10-16 22:11:08 +0300 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2021-10-17 12:12:35 +0100 |
commit | 1639ed7e0a9bc063599ec193b7b6af48f7d5faba (patch) | |
tree | 335f5127cf45a24245117ef4e6110f69948bd8e6 /Userland/Libraries/LibWeb/WebAssembly | |
parent | 51c33b3b35cbee59a3bb056ca96770c1b0285c71 (diff) | |
download | serenity-1639ed7e0a9bc063599ec193b7b6af48f7d5faba.zip |
LibJS: Convert to_double() to ThrowCompletionOr
Diffstat (limited to 'Userland/Libraries/LibWeb/WebAssembly')
-rw-r--r-- | Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp | 8 |
1 files changed, 2 insertions, 6 deletions
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<Wasm::Value> to_webassembly_value(JS::Value value, const Wasm::ValueTyp return Wasm::Value { static_cast<i32>(_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<double>(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<float>(number) }; } case Wasm::ValueType::FunctionReference: |