reactive_graph_graph/instances/flows/
flow_instance_errors.rs

1use crate::EntityTypeId;
2use crate::InvalidEntityInstanceError;
3use crate::InvalidRelationInstanceError;
4use crate::NamespacedTypeParseError;
5use thiserror::Error;
6use uuid::Uuid;
7
8#[derive(Debug, Error)]
9pub enum QueryFlowInstanceError {
10    #[error("The given uuid is invalid")]
11    InvalidUuid(#[from] uuid::Error),
12    #[error("The flow instance {0} does not exist")]
13    FlowInstanceDoesNotExist(Uuid),
14    #[error("No flow instance with label {0} exists")]
15    FlowInstanceWithLabelDoesNotExist(String),
16    #[error("The flow instance {0} is not of type {1}")]
17    FlowInstanceIsNotOfType(Uuid, EntityTypeId),
18}
19
20#[derive(Debug, Error)]
21pub enum CreateFlowInstanceError {
22    #[error("Cannot create entity instance of non-existing type {0}")]
23    EntityTypeDoesNotExist(EntityTypeId),
24    #[error("A flow with id {0} already exists")]
25    FlowAlreadyExists(Uuid),
26    #[error("An entity instance with id {0} already exists and cannot be used as wrapper entity instance")]
27    WrapperEntityInstanceAlreadyExists(Uuid),
28    #[error("Can't get the wrapper entity {0}")]
29    CantGetWrapperEntity(Uuid),
30}
31
32#[derive(Debug, Error)]
33pub enum InvalidFlowInstanceError {
34    #[error("The entity type of the flow instance is invalid: {0}")]
35    InvalidEntityType(#[from] NamespacedTypeParseError),
36    #[error("The entity instance of the flow instance is invalid: {0}")]
37    InvalidEntityInstance(#[from] InvalidEntityInstanceError),
38    #[error("The relation instance of the flow instance is invalid: {0}")]
39    InvalidRelationInstance(#[from] InvalidRelationInstanceError),
40    #[error("The flow instance is invalid because the entity type {0} does not exist")]
41    EntityTypeDoesNotExist(EntityTypeId),
42}