Skip to main content

folio_core/
error.rs

1//! Error types for the Folio library.
2
3use thiserror::Error;
4
5/// The primary error type for all Folio operations.
6#[derive(Debug, Error)]
7pub enum FolioError {
8    #[error("I/O error: {0}")]
9    Io(#[from] std::io::Error),
10
11    #[error("PDF parse error at byte offset {offset}: {message}")]
12    Parse { offset: u64, message: String },
13
14    #[error("Invalid PDF object: {0}")]
15    InvalidObject(String),
16
17    #[error("Encryption error: {0}")]
18    Encryption(String),
19
20    #[error("Signature error: {0}")]
21    Signature(String),
22
23    #[error("Invalid argument: {0}")]
24    InvalidArgument(String),
25
26    #[error("Unsupported feature: {0}")]
27    UnsupportedFeature(String),
28
29    #[error("Oracle error: {0}")]
30    Oracle(String),
31}
32
33/// Convenience Result type for Folio operations.
34pub type Result<T> = std::result::Result<T, FolioError>;