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
31
32
33
34
35
36
37
use thiserror::Error;

#[derive(Debug, Error, PartialEq)]
pub enum DomainError {
    #[error("Model `{}` not found", name)]
    ModelNotFound { name: String },

    #[error("Field `{}` on {} `{}` not found", name, container_type, container_name)]
    FieldNotFound {
        name: String,
        container_type: &'static str,
        container_name: String,
    },

    #[error("ScalarField `{}` on {} `{}` not found", name, container_type, container_name)]
    ScalarFieldNotFound {
        name: String,
        container_name: String,
        container_type: &'static str,
    },

    #[error("CompositeField `{}` on {} `{}` not found", name, container_type, container_name)]
    CompositeFieldNotFound {
        name: String,
        container_name: String,
        container_type: &'static str,
    },

    #[error("RelationField `{}` on model `{}` not found", name, model)]
    RelationFieldNotFound { name: String, model: String },

    #[error("Enum `{}` not found", name)]
    EnumNotFound { name: String },

    #[error("Conversion from `{}` to `{}` failed.", _0, _1)]
    ConversionFailure(String, String),
}