diff options
author | Idan Horowitz <idan.horowitz@gmail.com> | 2021-10-17 23:43:29 +0300 |
---|---|---|
committer | Idan Horowitz <idan.horowitz@gmail.com> | 2021-10-18 08:01:38 +0300 |
commit | cc94bba5c0461eebeb13a063c844330b0234e0bd (patch) | |
tree | ef837c94a8d60e7a04d65cf1e52ea54c3799afb4 /Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTableConstructor.cpp | |
parent | f6a5ff7b003930a1994c0f4c4a1c4b1da7c7123d (diff) | |
download | serenity-cc94bba5c0461eebeb13a063c844330b0234e0bd.zip |
LibJS: Convert to_u32() to ThrowCompletionOr
Diffstat (limited to 'Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTableConstructor.cpp')
-rw-r--r-- | Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTableConstructor.cpp | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTableConstructor.cpp b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTableConstructor.cpp index dc58bf4b42..6399af78f9 100644 --- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTableConstructor.cpp +++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTableConstructor.cpp @@ -56,17 +56,12 @@ JS::Value WebAssemblyTableConstructor::construct(FunctionObject&) auto initial_value = TRY_OR_DISCARD(descriptor->get("initial")); auto maximum_value = TRY_OR_DISCARD(descriptor->get("maximum")); - auto initial = initial_value.to_u32(global_object); - if (vm.exception()) - return {}; + auto initial = TRY_OR_DISCARD(initial_value.to_u32(global_object)); Optional<u32> maximum; - if (!maximum_value.is_undefined()) { - maximum = maximum_value.to_u32(global_object); - if (vm.exception()) - return {}; - } + if (!maximum_value.is_undefined()) + maximum = TRY_OR_DISCARD(maximum_value.to_u32(global_object)); if (maximum.has_value() && maximum.value() < initial) { vm.throw_exception<JS::RangeError>(global_object, "maximum should be larger than or equal to initial"); |