use std::convert::Infallible;
#[derive(Debug, thiserror::Error, PartialEq)]
pub enum ErnError {
#[error("Failed to parse {0}: {1}")]
ParseFailure(&'static str, String),
#[error("Part has invalid format (starts with ':' or contains '/')")]
IllegalPartFormat,
#[error("Builder Error - Invalid prefix: {0}")]
InvalidPrefix(String),
#[error("Builder Error - Unexpected part: {0}")]
UnexpectedPart(String),
#[error("Builder Error - Part has invalid format")]
InvalidPartFormat,
#[error("Root Error - Generating an Id failed: {0}")]
IdGenerationFailure(String),
#[error("Builder Error - Missing required part: {0}")]
MissingPart(String),
#[error("ERN has invalid format")]
InvalidFormat,
#[error("Infallible error")]
InfallibleError,
#[error("Entity Root Error: {0}")]
EntityRootError(#[from] mti::prelude::MagicTypeIdError),
}
impl From<Infallible> for ErnError {
fn from(_: Infallible) -> Self {
ErnError::InfallibleError
}
}