use crate::fields;
use displaydoc::Display;
#[derive(Display, Debug, PartialEq, Copy, Clone)]
#[non_exhaustive]
pub enum PatternError {
#[displaydoc("{0:?} invalid field length in pattern")]
FieldLengthInvalid(fields::FieldSymbol),
#[displaydoc("unknown substitution {0} in pattern")]
UnknownSubstitution(char),
#[displaydoc("invalid symbol {0} in pattern")]
InvalidSymbol(char),
#[displaydoc("unclosed literal in pattern")]
UnclosedLiteral,
#[displaydoc("unclosed placeholder in pattern")]
UnclosedPlaceholder,
#[displaydoc("plural pattern variants are only supported for week-of-month and week-of-year")]
UnsupportedPluralPivot,
}
#[cfg(feature = "std")]
impl std::error::Error for PatternError {}
impl From<fields::Error> for PatternError {
fn from(input: fields::Error) -> Self {
match input {
fields::Error::InvalidLength(symbol) => Self::FieldLengthInvalid(symbol),
}
}
}