1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 15:48:12 +00:00

LibJS: Return OptionalNone in fallible functions in the Intl namespace

This commit is contained in:
Timothy Flynn 2023-01-19 17:11:00 -05:00 committed by Linus Groh
parent 5349972f41
commit be8907e6bb
2 changed files with 6 additions and 5 deletions

View file

@ -32,7 +32,7 @@ static ThrowCompletionOr<Optional<String>> get_string_option(VM& vm, Object cons
{
auto option = TRY(get_option(vm, options, property, OptionType::String, values, Empty {}));
if (option.is_undefined())
return Optional<String> {};
return OptionalNone {};
if (validator && !validator(TRY(option.as_string().utf8_string_view())))
return vm.throw_completion<RangeError>(ErrorType::OptionIsNotValidValue, option, property);