reactive_graph_dynamic_graph_api/error/
mod.rs1use 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 PropertyContainerValidateUpdateError {
20 #[error("Can't update an immutable property: {0}")]
21 ImmutablePropertyError(#[from] ImmutablePropertyError),
22 #[error("Failed to update property: {0}")]
23 PropertyDataTypeError(#[from] PropertyDataTypeError),
24}
25
26#[derive(Debug, Error)]
27pub enum PropertyDataTypeError {
28 #[error("Null is not a valid datatype for property {0}!")]
29 NullIsNotAValidDataType(String),
30 #[error("Cannot set property {0} because value is of data type {1} but data type {2} is expected!")]
31 ValueIsNotOfTheExpectedDataType(String, DataType, DataType),
32}
33
34#[derive(Debug, Error)]
35pub enum PropertyArgumentMissingError {
36 #[error("The property argument {0} was missing!")]
37 PropertyArgumentMissing(String),
38}
39
40#[derive(Debug, Error)]
41#[error("Can't update immutable property {0}")]
42pub struct ImmutablePropertyError(pub String);
43
44#[derive(Debug, Error)]
45#[error("Can't find entity instance with id {0}")]
46pub struct EntityInstanceNotFound(pub Uuid);
47
48#[derive(Debug, Error)]
49#[error("The entity instance {0} is not of type {1}")]
50pub struct EntityInstanceIsNotOfType(pub Uuid, pub EntityTypeId);
51
52#[derive(Debug, Error)]
53#[error("Can't find flow instance with id {0}")]
54pub struct FlowInstanceNotFound(pub Uuid);
55
56#[derive(Debug, Error)]
57#[error("The flow instance {0} is not of entity type {2} which is defined in flow type {1}")]
58pub struct FlowInstanceIsNotOfType(pub Uuid, pub FlowTypeId, pub EntityTypeId);