Skip to main content

ooxml_sml/
error.rs

1//! Error types for SpreadsheetML parsing and writing.
2
3use thiserror::Error;
4
5/// Errors that can occur when working with XLSX files.
6#[derive(Error, Debug)]
7pub enum Error {
8    /// Error from the OPC packaging layer.
9    #[error("OPC error: {0}")]
10    Opc(#[from] ooxml_opc::Error),
11
12    /// XML parsing error.
13    #[error("XML error: {0}")]
14    Xml(#[from] quick_xml::Error),
15
16    /// I/O error.
17    #[error("I/O error: {0}")]
18    Io(#[from] std::io::Error),
19
20    /// XML serialization error.
21    #[error("Serialization error: {0}")]
22    Serialize(#[from] crate::generated_serializers::SerializeError),
23
24    /// Invalid or malformed content.
25    #[error("Invalid content: {0}")]
26    Invalid(String),
27
28    /// Unsupported feature.
29    #[error("Unsupported feature: {0}")]
30    Unsupported(String),
31}
32
33/// Result type for SpreadsheetML operations.
34pub type Result<T> = std::result::Result<T, Error>;