1use thiserror::Error;
4
5#[derive(Debug, Error)]
7pub enum OfdError {
8 #[error("I/O error: {0}")]
10 Io(#[from] std::io::Error),
11
12 #[error("zip container error: {0}")]
14 Zip(#[from] zip::result::ZipError),
15
16 #[error("xml parse error: {0}")]
18 Xml(#[from] quick_xml::DeError),
19
20 #[error("invalid {ty} value {value:?}: {reason}")]
22 BasicType {
23 ty: &'static str,
25 value: String,
27 reason: String,
29 },
30
31 #[error("entry not found in package: {0}")]
33 EntryNotFound(String),
34
35 #[error("invalid OFD structure: {0}")]
37 Structure(String),
38
39 #[error("image codec error: {0}")]
41 Image(#[from] image::ImageError),
42
43 #[error("render error: {0}")]
45 Render(String),
46}
47
48pub type Result<T> = std::result::Result<T, OfdError>;