mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:07:46 +00:00
LibLocale+LibJS: Make locale data APIs infallible
These APIs only perform small allocations, and are only used by LibJS. Callers which could only have failed from these APIs are also made to be infallible here.
This commit is contained in:
parent
a98201f889
commit
cd526813e6
20 changed files with 340 additions and 364 deletions
|
@ -106,7 +106,7 @@ ThrowCompletionOr<Value> canonical_code_for_display_names(VM& vm, DisplayNames::
|
|||
// 1. If type is "language", then
|
||||
if (type == DisplayNames::Type::Language) {
|
||||
// a. If code does not match the unicode_language_id production, throw a RangeError exception.
|
||||
if (!TRY_OR_THROW_OOM(vm, ::Locale::parse_unicode_language_id(code)).has_value())
|
||||
if (!::Locale::parse_unicode_language_id(code).has_value())
|
||||
return vm.throw_completion<RangeError>(ErrorType::OptionIsNotValidValue, code, "language"sv);
|
||||
|
||||
// b. If IsStructurallyValidLanguageTag(code) is false, throw a RangeError exception.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue