1use thiserror::Error;
2
3#[derive(Error, Debug)]
4pub enum PdfError {
5 #[error("IO error: {0}")]
6 Io(#[from] std::io::Error),
7
8 #[error("Invalid PDF structure: {0}")]
9 InvalidStructure(String),
10
11 #[error("Invalid object reference: {0}")]
12 InvalidReference(String),
13
14 #[error("Encoding error: {0}")]
15 EncodingError(String),
16
17 #[error("Font error: {0}")]
18 FontError(String),
19
20 #[error("Compression error: {0}")]
21 CompressionError(String),
22
23 #[error("Invalid image: {0}")]
24 InvalidImage(String),
25}
26
27pub type Result<T> = std::result::Result<T, PdfError>;
28
29#[derive(Error, Debug)]
31pub enum OxidizePdfError {
32 #[error("IO error: {0}")]
33 Io(#[from] std::io::Error),
34
35 #[error("Parse error: {0}")]
36 ParseError(String),
37
38 #[error("Invalid PDF structure: {0}")]
39 InvalidStructure(String),
40
41 #[error("Encoding error: {0}")]
42 EncodingError(String),
43
44 #[error("Other error: {0}")]
45 Other(String),
46}