Skip to main content

mx20022_parse/
error.rs

1//! Error types for XML parsing and serialization.
2
3use thiserror::Error;
4
5/// Errors that can occur during ISO 20022 XML parsing or serialization.
6#[derive(Debug, Error)]
7pub enum ParseError {
8    /// XML deserialization failed.
9    #[error("XML deserialization error: {0}")]
10    Deserialize(#[from] quick_xml::DeError),
11
12    /// XML serialization failed.
13    #[error("XML serialization error: {0}")]
14    Serialize(#[from] quick_xml::SeError),
15
16    /// An I/O error occurred.
17    #[error("I/O error: {0}")]
18    Io(#[from] std::io::Error),
19
20    /// The XML document does not have a valid ISO 20022 envelope.
21    #[error("invalid envelope: {0}")]
22    InvalidEnvelope(String),
23}