reactive_graph_dynamic_graph_api/error/
mod.rs

1use async_graphql::dynamic::SchemaError;
2use reactive_graph_graph::EntityTypeId;
3use reactive_graph_graph::FlowTypeId;
4use serde_json::Error;
5use thiserror::Error;
6use uuid::Uuid;
7
8use reactive_graph_graph::DataType;
9
10#[derive(Debug, Error)]
11pub enum DynamicQueryError {
12    #[error("Failed to generate the dynamic schema!")]
13    DynamicSchemaFailure(SchemaError),
14    #[error("Error in JSON: {0}")]
15    JsonError(#[from] Error),
16}
17
18#[derive(Debug, Error)]
19pub enum PropertyDataTypeError {
20    #[error("Null is not a valid datatype for property {0}!")]
21    NullIsNotAValidDataType(String),
22    #[error("Cannot set property {0} because value is of data type {1} but data type {2} is expected!")]
23    ValueIsNotOfTheExpectedDataType(String, DataType, DataType),
24}
25
26#[derive(Debug, Error)]
27#[error("Can't update immutable property {0}")]
28pub struct ImmutablePropertyError(pub String);
29
30#[derive(Debug, Error)]
31#[error("Can't find entity instance with id {0}")]
32pub struct EntityInstanceNotFound(pub Uuid);
33
34#[derive(Debug, Error)]
35#[error("The entity instance {0} is not of type {1}")]
36pub struct EntityInstanceIsNotOfType(pub Uuid, pub EntityTypeId);
37
38#[derive(Debug, Error)]
39#[error("Can't find flow instance with id {0}")]
40pub struct FlowInstanceNotFound(pub Uuid);
41
42#[derive(Debug, Error)]
43#[error("The flow instance {0} is not of entity type {2} which is defined in flow type {1}")]
44pub struct FlowInstanceIsNotOfType(pub Uuid, pub FlowTypeId, pub EntityTypeId);