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

LibJS+LibLocale: Propagate OOM from CLDR RelativeTime Vector operations

This commit is contained in:
Timothy Flynn 2023-02-02 21:37:08 -05:00 committed by Linus Groh
parent 340434ce09
commit 8670526f2a
4 changed files with 12 additions and 12 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2022, Tim Flynn <trflynn89@serenityos.org>
* Copyright (c) 2022-2023, Tim Flynn <trflynn89@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@ -247,7 +247,7 @@ static constexpr Array<@relative_time_format_index_type@, @size@> @name@ { {)~~~
generate_mapping(generator, cldr.locales, cldr.unique_formats.type_that_fits(), "s_locale_relative_time_formats"sv, "s_number_systems_digits_{}"sv, nullptr, [&](auto const& name, auto const& value) { append_list(name, value.time_units); });
generator.append(R"~~~(
Vector<RelativeTimeFormat> get_relative_time_format_patterns(StringView locale, TimeUnit time_unit, StringView tense_or_number, Style style)
ErrorOr<Vector<RelativeTimeFormat>> get_relative_time_format_patterns(StringView locale, TimeUnit time_unit, StringView tense_or_number, Style style)
{
Vector<RelativeTimeFormat> formats;
@ -268,7 +268,7 @@ Vector<RelativeTimeFormat> get_relative_time_format_patterns(StringView locale,
if (decode_string(locale_format.tense_or_number) != tense_or_number)
continue;
formats.append(locale_format.to_relative_time_format());
TRY(formats.try_append(locale_format.to_relative_time_format()));
}
return formats;