1use thiserror::Error;
4
5#[derive(Debug, Error)]
6pub enum OxmlError {
7 #[error("XML error: {0}")]
8 Xml(#[from] quick_xml::Error),
9
10 #[error("I/O error: {0}")]
11 Io(#[from] std::io::Error),
12
13 #[error("XML attribute error: {0}")]
14 XmlAttr(#[from] quick_xml::events::attributes::AttrError),
15
16 #[error("unexpected element: {0}")]
17 UnexpectedElement(String),
18
19 #[error("missing required element: {0}")]
20 MissingElement(String),
21
22 #[error("invalid value: {0}")]
23 InvalidValue(String),
24
25 #[error("UTF-8 error: {0}")]
26 Utf8(#[from] std::str::Utf8Error),
27
28 #[error("parse int error: {0}")]
29 ParseInt(#[from] std::num::ParseIntError),
30}
31
32pub type Result<T> = std::result::Result<T, OxmlError>;