mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:27:44 +00:00
LibJS: Mark infallible operations that may throw only due to OOM
This commit is contained in:
parent
52b76060f9
commit
95d1678553
18 changed files with 48 additions and 69 deletions
|
@ -110,13 +110,12 @@ ThrowCompletionOr<Value> canonical_code_for_display_names(VM& vm, DisplayNames::
|
|||
return vm.throw_completion<RangeError>(ErrorType::OptionIsNotValidValue, code, "language"sv);
|
||||
|
||||
// b. If IsStructurallyValidLanguageTag(code) is false, throw a RangeError exception.
|
||||
auto locale_id = TRY(is_structurally_valid_language_tag(vm, code));
|
||||
auto locale_id = MUST_OR_THROW_OOM(is_structurally_valid_language_tag(vm, code));
|
||||
if (!locale_id.has_value())
|
||||
return vm.throw_completion<RangeError>(ErrorType::IntlInvalidLanguageTag, code);
|
||||
|
||||
// c. Return ! CanonicalizeUnicodeLocaleId(code).
|
||||
// NOTE: We TRY this operation only to propagate OOM errors.
|
||||
auto canonicalized_tag = TRY(canonicalize_unicode_locale_id(vm, *locale_id));
|
||||
auto canonicalized_tag = MUST_OR_THROW_OOM(canonicalize_unicode_locale_id(vm, *locale_id));
|
||||
return PrimitiveString::create(vm, move(canonicalized_tag));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue