Skip to main content

spdf_types/
error.rs

1//! Error types shared across the workspace.
2
3use thiserror::Error;
4
5pub type SpdfResult<T> = Result<T, SpdfError>;
6
7#[derive(Debug, Error)]
8pub enum SpdfError {
9    #[error("I/O error: {0}")]
10    Io(#[from] std::io::Error),
11
12    #[error("JSON error: {0}")]
13    Json(#[from] serde_json::Error),
14
15    #[error("document is password-protected")]
16    PasswordRequired,
17
18    #[error("invalid password for protected document")]
19    InvalidPassword,
20
21    #[error("unsupported input format: {0}")]
22    UnsupportedFormat(String),
23
24    #[error("PDF parse error: {0}")]
25    Pdf(String),
26
27    #[error("OCR error: {0}")]
28    Ocr(String),
29
30    #[error("conversion failed: {0}")]
31    Conversion(String),
32
33    #[error("invalid configuration: {0}")]
34    InvalidConfig(String),
35
36    #[error("invalid input: {0}")]
37    InvalidInput(String),
38}