#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)]
pub enum Error {
#[error("{}", String::from_utf8_lossy(.0))]
Parse(Vec<u8>),
#[error("Email local part cannot be empty after normalization")]
EmptyLocal,
}
impl Error {
pub fn php_class(&self) -> &'static str {
match self {
Error::Parse(_) => "Exception",
Error::EmptyLocal => "InvalidArgumentException",
}
}
pub fn message(&self) -> &[u8] {
match self {
Error::Parse(message) => message,
Error::EmptyLocal => b"Email local part cannot be empty after normalization",
}
}
}