#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)]
pub enum Error {
#[error("{0}")]
Value(String),
#[error("{0}")]
Type(String),
#[error("{message}")]
Custom {
class: &'static str,
message: String,
},
}
impl Error {
pub fn php_class(&self) -> &'static str {
match self {
Error::Value(_) => "ValueError",
Error::Type(_) => "TypeError",
Error::Custom { class, .. } => class,
}
}
}