1use thiserror::Error;
4
5pub type Result<T> = std::result::Result<T, Error>;
7
8#[derive(Error, Debug)]
10pub enum Error {
11 #[error("IO error: {0}")]
13 Io(#[from] std::io::Error),
14
15 #[error("Parse error: {message} at position {position}")]
17 Parse { message: String, position: usize },
18
19 #[error("Invalid PDF structure: {0}")]
21 InvalidStructure(String),
22
23 #[error("Missing required object: {0}")]
25 MissingObject(String),
26
27 #[error("Invalid object type: expected {expected}, got {actual}")]
29 InvalidObjectType { expected: String, actual: String },
30
31 #[error("Unsupported feature: {0}")]
33 Unsupported(String),
34
35 #[error("SVG error: {0}")]
37 Svg(String),
38
39 #[error("Encoding error: {0}")]
41 Encoding(String),
42
43 #[error("Compression error: {0}")]
45 Compression(String),
46
47 #[error("Font error: {0}")]
49 Font(String),
50
51 #[error("Image error: {0}")]
53 Image(String),
54}