xsd_parser/generator/error.rs
1use thiserror::Error;
2
3use crate::schema::NamespaceId;
4
5use super::Ident;
6
7/// Error that might be raised by the [`Generator`](super::Generator).
8#[derive(Debug, Error)]
9pub enum Error {
10 /// Unknown type identifier.
11 ///
12 /// Is raised if a specific identifier could not be resolved to it's
13 /// corresponding type information.
14 #[error("Unknown type identifier: {0}!")]
15 UnknownType(Ident),
16
17 /// Unknown namespace.
18 ///
19 /// Is raised if a specific namespace id could not be resolved to it's
20 /// corresponding namespace information.
21 #[error("Unknown namespace: {0:?}!")]
22 UnknownNamespace(NamespaceId),
23
24 /// Invalid default value.
25 ///
26 /// Is raised if the default value for an attribute defined in the schema
27 /// could not be converted to a suitable default code snippet.
28 #[error("Invalid default value for type {0:?}: {1}!")]
29 InvalidDefaultValue(Ident, String),
30}