Skip to main content

openbim_gaeb/
error.rs

1use thiserror::Error;
2
3/// Errors that prevent a document or edit from being represented safely.
4#[derive(Debug, Error)]
5#[non_exhaustive]
6pub enum Error {
7    #[error("input does not look like XML")]
8    NotXml,
9    #[error("XML root is not a namespaced GAEB document")]
10    NotGaeb,
11    #[error("invalid XML: {0}")]
12    Xml(String),
13    #[error("I/O error: {0}")]
14    Io(#[from] std::io::Error),
15    #[error("{0:?} is not an XML Schema decimal lexical value")]
16    InvalidDecimal(String),
17    #[error("GAEB item {0:?} was not found")]
18    ItemNotFound(String),
19    #[error("GAEB item ID {0:?} occurs more than once")]
20    AmbiguousItem(String),
21    #[error("GAEB item {0:?} has no Qty value")]
22    QuantityMissing(String),
23    #[error(
24        "GAEB item {0:?} has a Qty value that cannot be edited without changing non-value XML"
25    )]
26    QuantityNotEditable(String),
27}