1use thiserror::Error;
2
3use crate::declarative::DeclarativeError;
4
5#[derive(Debug, Error)]
6pub enum FomodError {
7 #[error("XML parsing error: {0}")]
8 Xml(#[from] quick_xml::DeError),
9
10 #[error("missing required element: {0}")]
11 MissingElement(&'static str),
12
13 #[error("invalid attribute value for `{attr}`: {value}")]
14 InvalidAttribute { attr: &'static str, value: String },
15
16 #[error("unsupported schema version: {0}")]
17 UnsupportedVersion(String),
18
19 #[error(transparent)]
20 Declarative(#[from] DeclarativeError),
21}
22
23pub type Result<T> = std::result::Result<T, FomodError>;