#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum ParseError {
Pin(sashite_pin::ParseError),
DerivationMarker,
}
impl core::fmt::Display for ParseError {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::Pin(source) => write!(f, "invalid EPIN core: {source}"),
Self::DerivationMarker => {
f.write_str("EPIN derivation marker (') must be the final character")
}
}
}
}
impl core::error::Error for ParseError {
fn source(&self) -> Option<&(dyn core::error::Error + 'static)> {
match self {
Self::Pin(source) => Some(source),
Self::DerivationMarker => None,
}
}
}
impl From<sashite_pin::ParseError> for ParseError {
fn from(source: sashite_pin::ParseError) -> Self {
Self::Pin(source)
}
}