1use rpdfium_core::error::PdfError;
9use rpdfium_doc::DocError;
10use rpdfium_parser::object::ObjectId;
11
12#[derive(Debug, thiserror::Error)]
14pub enum EditError {
15 #[error(transparent)]
17 Parse(#[from] PdfError),
18
19 #[error(transparent)]
21 Doc(#[from] DocError),
22
23 #[error(transparent)]
25 Io(#[from] std::io::Error),
26
27 #[error("page index out of range: {index} (document has {count} pages)")]
29 PageOutOfRange {
30 index: usize,
32 count: usize,
34 },
35
36 #[error("annotation not found: {0}")]
38 AnnotationNotFound(ObjectId),
39
40 #[error("invalid page object index: {0}")]
42 InvalidObjectIndex(usize),
43
44 #[error("field not found: {0}")]
46 FieldNotFound(String),
47
48 #[error("encryption error: {0}")]
50 Encryption(String),
51
52 #[error("not supported: {0}")]
54 NotSupported(String),
55
56 #[error("{0}")]
58 Other(String),
59}
60
61pub type EditResult<T> = std::result::Result<T, EditError>;