| 1 |
#ifndef ICU4XError_HPP |
| 2 |
#define ICU4XError_HPP |
| 3 |
#include <stdint.h> |
| 4 |
#include <stddef.h> |
| 5 |
#include <stdbool.h> |
| 6 |
#include <algorithm> |
| 7 |
#include <memory> |
| 8 |
#include <variant> |
| 9 |
#include <optional> |
| 10 |
#include "diplomat_runtime.hpp" |
| 11 |
|
| 12 |
#include "ICU4XError.h" |
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
/** |
| 17 |
* A common enum for errors that ICU4X may return, organized by API |
| 18 |
* |
| 19 |
* The error names are stable and can be checked against as strings in the JS API |
| 20 |
* |
| 21 |
* Additional information: [1](https://docs.rs/fixed_decimal/latest/fixed_decimal/enum.FixedDecimalError.html), [2](https://docs.rs/icu/latest/icu/calendar/enum.CalendarError.html), [3](https://docs.rs/icu/latest/icu/collator/enum.CollatorError.html), [4](https://docs.rs/icu/latest/icu/datetime/enum.DateTimeError.html), [5](https://docs.rs/icu/latest/icu/decimal/enum.DecimalError.html), [6](https://docs.rs/icu/latest/icu/list/enum.ListError.html), [7](https://docs.rs/icu/latest/icu/locid/enum.ParserError.html), [8](https://docs.rs/icu/latest/icu/locid_transform/enum.LocaleTransformError.html), [9](https://docs.rs/icu/latest/icu/normalizer/enum.NormalizerError.html), [10](https://docs.rs/icu/latest/icu/plurals/enum.PluralsError.html), [11](https://docs.rs/icu/latest/icu/properties/enum.PropertiesError.html), [12](https://docs.rs/icu/latest/icu/provider/struct.DataError.html), [13](https://docs.rs/icu/latest/icu/provider/enum.DataErrorKind.html), [14](https://docs.rs/icu/latest/icu/segmenter/enum.SegmenterError.html), [15](https://docs.rs/icu/latest/icu/timezone/enum.TimeZoneError.html), [16](https://docs.rs/icu_experimental/latest/icu_experimental/units/enum.ConversionError.html) |
| 22 |
*/ |
| 23 |
enum struct ICU4XError { |
| 24 |
|
| 25 |
/** |
| 26 |
* The error is not currently categorized as ICU4XError. |
| 27 |
* Please file a bug |
| 28 |
*/ |
| 29 |
UnknownError = 0, |
| 30 |
|
| 31 |
/** |
| 32 |
* An error arising from writing to a string |
| 33 |
* Typically found when not enough space is allocated |
| 34 |
* Most APIs that return a string may return this error |
| 35 |
*/ |
| 36 |
WriteableError = 1, |
| 37 |
|
| 38 |
/** |
| 39 |
* Some input was out of bounds |
| 40 |
*/ |
| 41 |
OutOfBoundsError = 2, |
| 42 |
|
| 43 |
/** |
| 44 |
* Input expected to be UTF-8 was ill-formed |
| 45 |
*/ |
| 46 |
Utf8Error = 3, |
| 47 |
DataMissingDataKeyError = 256, |
| 48 |
DataMissingVariantError = 257, |
| 49 |
DataMissingLocaleError = 258, |
| 50 |
DataNeedsVariantError = 259, |
| 51 |
DataNeedsLocaleError = 260, |
| 52 |
DataExtraneousLocaleError = 261, |
| 53 |
DataFilteredResourceError = 262, |
| 54 |
DataMismatchedTypeError = 263, |
| 55 |
DataMissingPayloadError = 264, |
| 56 |
DataInvalidStateError = 265, |
| 57 |
DataCustomError = 266, |
| 58 |
DataIoError = 267, |
| 59 |
DataUnavailableBufferFormatError = 268, |
| 60 |
DataMismatchedAnyBufferError = 269, |
| 61 |
|
| 62 |
/** |
| 63 |
* The subtag being requested was not set |
| 64 |
*/ |
| 65 |
LocaleUndefinedSubtagError = 512, |
| 66 |
|
| 67 |
/** |
| 68 |
* The locale or subtag string failed to parse |
| 69 |
*/ |
| 70 |
LocaleParserLanguageError = 513, |
| 71 |
LocaleParserSubtagError = 514, |
| 72 |
LocaleParserExtensionError = 515, |
| 73 |
|
| 74 |
/** |
| 75 |
* Attempted to construct an invalid data struct |
| 76 |
*/ |
| 77 |
DataStructValidityError = 768, |
| 78 |
PropertyUnknownScriptIdError = 1024, |
| 79 |
PropertyUnknownGeneralCategoryGroupError = 1025, |
| 80 |
PropertyUnexpectedPropertyNameError = 1026, |
| 81 |
FixedDecimalLimitError = 1280, |
| 82 |
FixedDecimalSyntaxError = 1281, |
| 83 |
PluralsParserError = 1536, |
| 84 |
CalendarParseError = 1792, |
| 85 |
CalendarOverflowError = 1793, |
| 86 |
CalendarUnderflowError = 1794, |
| 87 |
CalendarOutOfRangeError = 1795, |
| 88 |
CalendarUnknownEraError = 1796, |
| 89 |
CalendarUnknownMonthCodeError = 1797, |
| 90 |
CalendarMissingInputError = 1798, |
| 91 |
CalendarUnknownKindError = 1799, |
| 92 |
CalendarMissingError = 1800, |
| 93 |
DateTimePatternError = 2048, |
| 94 |
DateTimeMissingInputFieldError = 2049, |
| 95 |
DateTimeSkeletonError = 2050, |
| 96 |
DateTimeUnsupportedFieldError = 2051, |
| 97 |
DateTimeUnsupportedOptionsError = 2052, |
| 98 |
DateTimeMissingWeekdaySymbolError = 2053, |
| 99 |
DateTimeMissingMonthSymbolError = 2054, |
| 100 |
DateTimeFixedDecimalError = 2055, |
| 101 |
DateTimeMismatchedCalendarError = 2056, |
| 102 |
TinyStrTooLargeError = 2304, |
| 103 |
TinyStrContainsNullError = 2305, |
| 104 |
TinyStrNonAsciiError = 2306, |
| 105 |
TimeZoneOffsetOutOfBoundsError = 2560, |
| 106 |
TimeZoneInvalidOffsetError = 2561, |
| 107 |
TimeZoneMissingInputError = 2562, |
| 108 |
TimeZoneInvalidIdError = 2563, |
| 109 |
NormalizerFutureExtensionError = 2816, |
| 110 |
NormalizerValidationError = 2817, |
| 111 |
InvalidCldrUnitIdentifierError = 3072, |
| 112 |
}; |
| 113 |
|
| 114 |
#endif |