1 | // This file is part of ICU4X. For terms of use, please see the file |
2 | // called LICENSE at the top level of the ICU4X source tree |
3 | // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). |
4 | |
5 | use displaydoc::Display; |
6 | use icu_provider::DataError; |
7 | |
8 | #[cfg (feature = "std" )] |
9 | impl std::error::Error for PropertiesError {} |
10 | |
11 | /// A list of error outcomes for various operations in this module. |
12 | /// |
13 | /// Re-exported as [`Error`](crate::Error). |
14 | #[derive (Display, Debug, Copy, Clone, PartialEq, Eq)] |
15 | #[non_exhaustive ] |
16 | pub enum PropertiesError { |
17 | /// An error occurred while loading data |
18 | #[displaydoc("{0}" )] |
19 | PropDataLoad(DataError), |
20 | /// An unknown value was used for the [`Script`](super::Script) property |
21 | #[displaydoc("Unknown script id: {0}" )] |
22 | UnknownScriptId(u16), |
23 | /// An unknown value was used for the [`GeneralCategoryGroup`](super::GeneralCategoryGroup) property |
24 | #[displaydoc("Unknown general category group: {0}" )] |
25 | UnknownGeneralCategoryGroup(u32), |
26 | /// An unknown or unexpected property name was used for an API dealing with properties specified as strings at runtime |
27 | #[displaydoc("Unexpected or unknown property name" )] |
28 | UnexpectedPropertyName, |
29 | } |
30 | |
31 | impl From<DataError> for PropertiesError { |
32 | fn from(e: DataError) -> Self { |
33 | PropertiesError::PropDataLoad(e) |
34 | } |
35 | } |
36 | |