#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)]
pub enum Error {
#[error("{0}")]
InvalidArgument(String),
#[error("{0}")]
Codec(String),
#[error("{0}")]
Unsupported(String),
}
impl Error {
pub fn php_class(&self) -> &'static str {
match self {
Error::InvalidArgument(_) => "InvalidArgumentException",
Error::Codec(_) => "ErrorException",
Error::Unsupported(_) => "Error",
}
}
#[allow(dead_code)]
pub(crate) fn undefined(function: &str) -> Self {
Error::Unsupported(format!("Call to undefined function Utopia\\Compression\\Algorithms\\{function}()"))
}
}