Skip to main content

xml_arrow/
error.rs

1/// Result with [`Error`].
2pub type Result<T> = std::result::Result<T, Error>;
3
4/// XML-to-Arrow conversion error.
5#[derive(Debug, thiserror::Error)]
6pub enum Error {
7    /// Invalid schema, path, or options.
8    #[error("invalid configuration: {0}")]
9    Configuration(String),
10    /// XML parsing error.
11    #[error("XML: {0}")]
12    Xml(#[from] roxmltree::Error),
13    /// Unsupported XML feature.
14    #[error("unsupported XML: {0}")]
15    UnsupportedXml(&'static str),
16    /// Invalid or missing field value.
17    #[error("field {name:?} at {path:?}: {message}")]
18    Field {
19        /// Column name.
20        name: String,
21        /// Relative XML path.
22        path: String,
23        /// Failure reason.
24        message: String,
25    },
26    /// Flush before appending more rows.
27    #[error("batch is full; flush before appending")]
28    BatchFull,
29    /// Arrow error.
30    #[error("Arrow: {0}")]
31    Arrow(#[from] arrow_schema::ArrowError),
32}