docx_rust/
error.rs

1use std::io::Error as IOError;
2
3use hard_xml::XmlError;
4use thiserror::Error;
5use zip::result::ZipError;
6
7/// Error type of docx-rs
8#[derive(Debug, Error)]
9pub enum DocxError {
10    #[error("IO error: {0}")]
11    IO(#[from] IOError),
12    #[error("malformed XML: {0}")]
13    Xml(#[from] XmlError),
14    #[error("unable to unpack file: {0}")]
15    Zip(#[from] ZipError),
16    #[cfg(feature = "async")]
17    #[error("unable to unpack file: {0}")]
18    AsyncZip(#[from] async_zip::error::ZipError),
19}
20
21/// Specialized `Result` which the error value is `DocxError`.
22pub type DocxResult<T> = Result<T, DocxError>;