xsd_parser/generator/
error.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
use thiserror::Error;

use crate::schema::NamespaceId;

use super::Ident;

/// Error that might be raised by the [`Generator`](super::Generator).
#[derive(Debug, Error)]
pub enum Error {
    /// Unknown type identifier.
    ///
    /// Is raised if a specific identifier could not be resolved to it's
    /// corresponding type information.
    #[error("Unknown type identifier: {0}!")]
    UnknownType(Ident),

    /// Unknown namespace.
    ///
    /// Is raised if a specific namespace id could not be resolved to it's
    /// corresponding namespace information.
    #[error("Unknown namespace: {0:?}!")]
    UnknownNamespace(NamespaceId),

    /// Invalid default value.
    ///
    /// Is raised if the default value for an attribute defined in the schema
    /// could not be converted to a suitable default code snippet.
    #[error("Invalid default value for type {0:?}: {1}!")]
    InvalidDefaultValue(Ident, String),
}