use arcbox_error::CommonError;
use thiserror::Error;
pub type Result<T> = std::result::Result<T, ImageError>;
#[derive(Debug, Error)]
pub enum ImageError {
#[error(transparent)]
Common(#[from] CommonError),
#[error("image error: {0}")]
Image(String),
}
impl ImageError {
#[must_use]
pub fn config(msg: impl Into<String>) -> Self {
Self::Common(CommonError::config(msg))
}
#[must_use]
pub fn not_found(resource: impl Into<String>) -> Self {
Self::Common(CommonError::not_found(resource))
}
#[must_use]
pub fn image(msg: impl Into<String>) -> Self {
Self::Image(msg.into())
}
}
impl From<std::io::Error> for ImageError {
fn from(err: std::io::Error) -> Self {
Self::Common(CommonError::from(err))
}
}