Skip to main content

ooxml_opc/
error.rs

1//! Error types for the ooxml crate.
2
3use thiserror::Error;
4
5/// Result type for ooxml operations.
6pub type Result<T> = std::result::Result<T, Error>;
7
8/// Errors that can occur when working with OOXML files.
9#[derive(Debug, Error)]
10pub enum Error {
11    /// IO error (file operations, ZIP handling).
12    #[error("io error: {0}")]
13    Io(#[from] std::io::Error),
14
15    /// ZIP archive error.
16    #[error("zip error: {0}")]
17    Zip(#[from] zip::result::ZipError),
18
19    /// XML parsing error.
20    #[error("xml error: {0}")]
21    Xml(#[from] quick_xml::Error),
22
23    /// Invalid or malformed OOXML structure.
24    #[error("invalid ooxml: {0}")]
25    Invalid(String),
26
27    /// Missing required part in the package.
28    #[error("missing part: {0}")]
29    MissingPart(String),
30
31    /// Unsupported feature or element.
32    #[error("unsupported: {0}")]
33    Unsupported(String),
34}