1use thiserror::Error;
4
5#[derive(Debug, Error)]
7pub enum Error {
8 #[error("IO error: {0}")]
9 Io(#[from] std::io::Error),
10
11 #[error("ZIP error: {0}")]
12 Zip(#[from] zip::result::ZipError),
13
14 #[error("XML error: {0}")]
15 Xml(#[from] quick_xml::Error),
16
17 #[error("XML encoding error: {0}")]
18 XmlEncoding(#[from] quick_xml::encoding::EncodingError),
19
20 #[error("XML attribute error: {0}")]
21 XmlAttr(#[from] quick_xml::events::attributes::AttrError),
22
23 #[error("UTF-8 error: {0}")]
24 Utf8(#[from] std::str::Utf8Error),
25
26 #[error("Missing required part: {0}")]
27 MissingPart(String),
28
29 #[error("Invalid part URI: {0}")]
30 InvalidPartUri(String),
31
32 #[error("Invalid content type: {0}")]
33 InvalidContentType(String),
34
35 #[error("Invalid relationship: {0}")]
36 InvalidRelationship(String),
37
38 #[error("Missing attribute '{attr}' on element '{element}'")]
39 MissingAttribute { element: String, attr: String },
40
41 #[error("Invalid document: {0}")]
42 InvalidDocument(String),
43
44 #[error("Part not found: {0}")]
45 PartNotFound(String),
46}
47
48pub type Result<T> = std::result::Result<T, Error>;