foodshare_image/
error.rs

1//! Error types for the image crate.
2
3use thiserror::Error;
4
5/// Result type alias for image operations.
6pub type Result<T> = std::result::Result<T, ImageError>;
7
8/// Errors that can occur during image operations.
9#[derive(Debug, Error)]
10pub enum ImageError {
11    /// Unknown image format
12    #[error("Unknown image format")]
13    UnknownFormat,
14
15    /// Invalid image data
16    #[error("Invalid image data: {0}")]
17    InvalidData(String),
18
19    /// Resize error
20    #[error("Resize error: {0}")]
21    ResizeError(String),
22
23    /// IO error
24    #[error("IO error: {0}")]
25    IoError(#[from] std::io::Error),
26
27    /// Image processing error
28    #[cfg(feature = "processing")]
29    #[error("Image processing error: {0}")]
30    ProcessingError(#[from] image::ImageError),
31}