diff options
Diffstat (limited to 'third_party/rust/unic-langid-impl/src/parser/errors.rs')
-rw-r--r-- | third_party/rust/unic-langid-impl/src/parser/errors.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/third_party/rust/unic-langid-impl/src/parser/errors.rs b/third_party/rust/unic-langid-impl/src/parser/errors.rs new file mode 100644 index 0000000000..acc36bff96 --- /dev/null +++ b/third_party/rust/unic-langid-impl/src/parser/errors.rs @@ -0,0 +1,20 @@ +use std::error::Error; +use std::fmt::{self, Display}; + +#[derive(Debug, PartialEq)] +pub enum ParserError { + InvalidLanguage, + InvalidSubtag, +} + +impl Error for ParserError {} + +impl Display for ParserError { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + let value = match self { + ParserError::InvalidLanguage => "The given language subtag is invalid", + ParserError::InvalidSubtag => "Invalid subtag", + }; + f.write_str(value) + } +} |