#[derive(Debug, Clone, PartialEq, Eq)]
#[non_exhaustive]
pub enum Error {
EmptyInput,
ReservedDomain,
InvalidUtf8,
MissingPrefix,
WrongLength,
InvalidBase58,
}
impl core::fmt::Display for Error {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::EmptyInput => write!(f, "ag_id: input must not be empty"),
Self::ReservedDomain => write!(f, "ag_id: domain byte 0x00 is reserved"),
Self::InvalidUtf8 => write!(f, "ag_id: input is not valid UTF-8"),
Self::MissingPrefix => write!(f, "ag_id: missing 'did:agid:' prefix"),
Self::WrongLength => write!(f, "ag_id: base58 payload has wrong length"),
Self::InvalidBase58 => write!(f, "ag_id: invalid character in base58 payload"),
}
}
}
#[cfg(feature = "std")]
impl std::error::Error for Error {}