Skip to main content

captcha_engine/
error.rs

1//! Error types for the captcha engine.
2
3/// Result type alias for captcha engine operations.
4pub type Result<T> = std::result::Result<T, Error>;
5
6/// Errors that can occur during captcha processing.
7#[derive(Debug, thiserror::Error)]
8pub enum Error {
9    /// I/O error (file operations).
10    #[error(transparent)]
11    Io(#[from] std::io::Error),
12
13    /// Image processing error.
14    #[error(transparent)]
15    Image(#[from] image::ImageError),
16
17    /// HTTP request error (only available with `download` feature).
18    #[cfg(feature = "download")]
19    #[error(transparent)]
20    Request(#[from] reqwest::Error),
21
22    /// Model download failed.
23    #[error("Model download failed: {0}")]
24    ModelDownload(String),
25
26    /// Model loading failed.
27    #[error("Model load failed: {0}")]
28    ModelLoad(String),
29
30    /// Inference failed.
31    #[error("Inference failed: {0}")]
32    Inference(String),
33}