diff options
Diffstat (limited to 'Userland')
3 files changed, 8 insertions, 7 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/Intl/AbstractOperations.cpp b/Userland/Libraries/LibJS/Runtime/Intl/AbstractOperations.cpp index cb352b007a..06f42df342 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/AbstractOperations.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/AbstractOperations.cpp @@ -683,18 +683,18 @@ ThrowCompletionOr<Optional<int>> default_number_option(GlobalObject& global_obje } // 9.2.15 GetNumberOption ( options, property, minimum, maximum, fallback ), https://tc39.es/ecma402/#sec-getnumberoption -Optional<int> get_number_option(GlobalObject& global_object, Object const& options, PropertyName const& property, int minimum, int maximum, Optional<int> fallback) +ThrowCompletionOr<Optional<int>> get_number_option(GlobalObject& global_object, Object const& options, PropertyName const& property, int minimum, int maximum, Optional<int> fallback) { auto& vm = global_object.vm(); // 1. Assert: Type(options) is Object. // 2. Let value be ? Get(options, property). auto value = options.get(property); - if (vm.exception()) - return {}; + if (auto* exception = vm.exception()) + return throw_completion(exception->value()); // 3. Return ? DefaultNumberOption(value, minimum, maximum, fallback). - return TRY_OR_DISCARD(default_number_option(global_object, value, minimum, maximum, move(fallback))); + return default_number_option(global_object, value, minimum, maximum, move(fallback)); } // 9.2.16 PartitionPattern ( pattern ), https://tc39.es/ecma402/#sec-partitionpattern diff --git a/Userland/Libraries/LibJS/Runtime/Intl/AbstractOperations.h b/Userland/Libraries/LibJS/Runtime/Intl/AbstractOperations.h index 5bc3bc3904..f69977c183 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/AbstractOperations.h +++ b/Userland/Libraries/LibJS/Runtime/Intl/AbstractOperations.h @@ -48,7 +48,7 @@ ThrowCompletionOr<Array*> supported_locales(GlobalObject&, Vector<String> const& ThrowCompletionOr<Object*> coerce_options_to_object(GlobalObject& global_object, Value options); ThrowCompletionOr<Value> get_option(GlobalObject& global_object, Object const& options, PropertyName const& property, Value::Type type, Vector<StringView> const& values, Fallback fallback); ThrowCompletionOr<Optional<int>> default_number_option(GlobalObject& global_object, Value value, int minimum, int maximum, Optional<int> fallback); -Optional<int> get_number_option(GlobalObject& global_object, Object const& options, PropertyName const& property, int minimum, int maximum, Optional<int> fallback); +ThrowCompletionOr<Optional<int>> get_number_option(GlobalObject& global_object, Object const& options, PropertyName const& property, int minimum, int maximum, Optional<int> fallback); Vector<PatternPartition> partition_pattern(StringView pattern); } diff --git a/Userland/Libraries/LibJS/Runtime/Intl/NumberFormat.cpp b/Userland/Libraries/LibJS/Runtime/Intl/NumberFormat.cpp index cd498bb62b..d00cc29223 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/NumberFormat.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/NumberFormat.cpp @@ -249,9 +249,10 @@ void set_number_format_digit_options(GlobalObject& global_object, NumberFormat& // 4. Assert: Type(mxfdDefault) is Number. // 5. Let mnid be ? GetNumberOption(options, "minimumIntegerDigits,", 1, 21, 1). - auto min_integer_digits = get_number_option(global_object, options, vm.names.minimumIntegerDigits, 1, 21, 1); - if (vm.exception()) + auto min_integer_digits_or_error = get_number_option(global_object, options, vm.names.minimumIntegerDigits, 1, 21, 1); + if (min_integer_digits_or_error.is_error()) return; + auto min_integer_digits = min_integer_digits_or_error.release_value(); // 6. Let mnfd be ? Get(options, "minimumFractionDigits"). auto min_fraction_digits = options.get(vm.names.minimumFractionDigits); |