diff options
author | Idan Horowitz <idan.horowitz@gmail.com> | 2021-09-18 19:31:17 +0300 |
---|---|---|
committer | Idan Horowitz <idan.horowitz@gmail.com> | 2021-09-18 22:21:15 +0300 |
commit | de9785b71b5fd2779b6094a2d12022ad2e6df2bd (patch) | |
tree | 00a6253c2262f46dda2a5e3da67506ab743a368b /Userland/Libraries/LibJS/Runtime/Intl/LocaleConstructor.cpp | |
parent | 3758e6529373eea03393dcc8d30ab4e04bac7d5e (diff) | |
download | serenity-de9785b71b5fd2779b6094a2d12022ad2e6df2bd.zip |
LibJS: Convert Intl::get_option() to ThrowCompletionOr
Diffstat (limited to 'Userland/Libraries/LibJS/Runtime/Intl/LocaleConstructor.cpp')
-rw-r--r-- | Userland/Libraries/LibJS/Runtime/Intl/LocaleConstructor.cpp | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/Intl/LocaleConstructor.cpp b/Userland/Libraries/LibJS/Runtime/Intl/LocaleConstructor.cpp index 0d8e56adb0..3919b9c094 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/LocaleConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/LocaleConstructor.cpp @@ -30,9 +30,7 @@ static Optional<String> get_string_option(GlobalObject& global_object, Object co { auto& vm = global_object.vm(); - auto option = get_option(global_object, options, property, Value::Type::String, values, Empty {}); - if (vm.exception()) - return {}; + auto option = TRY_OR_DISCARD(get_option(global_object, options, property, Value::Type::String, values, Empty {})); if (option.is_undefined()) return {}; @@ -342,9 +340,7 @@ Value LocaleConstructor::construct(FunctionObject& new_target) return {}; // 23. Let kn be ? GetOption(options, "numeric", "boolean", undefined, undefined). - auto kn = get_option(global_object, *options, vm.names.numeric, Value::Type::Boolean, {}, Empty {}); - if (vm.exception()) - return {}; + auto kn = TRY_OR_DISCARD(get_option(global_object, *options, vm.names.numeric, Value::Type::Boolean, {}, Empty {})); // 24. If kn is not undefined, set kn to ! ToString(kn). // 25. Set opt.[[kn]] to kn. |