//! Error types for the image classifier demo use thiserror::Error; /// Result type for classifier operations pub type Result = std::result::Result; /// Errors that can occur during image classification #[derive(Debug, Error)] pub enum ClassifierError { /// Model not initialized #[error("Classifier not initialized. Call initialize() first.")] NotInitialized, /// Invalid image data #[error("Invalid image data: {0}")] InvalidImage(String), /// Base64 decode error #[error("Failed to decode base64 image: {0}")] Base64DecodeError(#[from] base64::DecodeError), /// Image processing error #[error("Image processing error: {0}")] ImageError(#[from] image::ImageError), /// Model inference error #[error("Model inference failed: {0}")] InferenceError(String), /// Vision library error #[error("Vision error: {0}")] VisionError(String), /// Tensor operation error #[error("Tensor error: {0}")] TensorError(String), /// IO error #[error("IO error: {0}")] IoError(#[from] std::io::Error), /// Configuration error #[error("Invalid configuration: {0}")] ConfigError(String), } impl From for ClassifierError { fn from(e: rtx_vision::error::VisionError) -> Self { Self::VisionError(e.to_string()) } } impl From for ClassifierError { fn from(e: rtx_tensor::error::TensorError) -> Self { Self::TensorError(e.to_string()) } }