docx_lite/
error.rs

1use thiserror::Error;
2
3#[derive(Error, Debug)]
4pub enum DocxError {
5    #[error("IO error: {0}")]
6    Io(#[from] std::io::Error),
7
8    #[error("ZIP error: {0}")]
9    Zip(#[from] zip::result::ZipError),
10
11    #[error("XML parsing error: {0}")]
12    Xml(#[from] quick_xml::Error),
13
14    #[error("UTF-8 decoding error: {0}")]
15    Utf8(#[from] std::str::Utf8Error),
16
17    #[error("Document structure error: {0}")]
18    Structure(String),
19
20    #[error("Required file not found in DOCX: {0}")]
21    FileNotFound(String),
22
23    #[error("Unsupported DOCX format: {0}")]
24    UnsupportedFormat(String),
25}
26
27pub type Result<T> = std::result::Result<T, DocxError>;