reactive_graph_reactive_service_api/error/
entity.rs1use thiserror::Error;
2use uuid::Uuid;
3
4use reactive_graph_graph::ComponentTypeId;
5use reactive_graph_graph::EntityTypeId;
6
7#[derive(Debug, Error)]
8pub enum ReactiveEntityCreationError {
9 #[error("Cannot create reactive entity because uuid {0} is already taken!")]
10 UuidTaken(Uuid),
11 #[error("The created instance cannot be found!")]
12 MissingInstance,
13 #[error("Failed to register reactive entity instance: {0}")]
14 ReactiveEntityRegistrationError(#[from] ReactiveEntityRegistrationError),
15}
16
17#[derive(Debug, Error)]
18pub enum ReactiveEntityRegistrationError {
19 #[error("Cannot register reactive entity because uuid {0} is already taken!")]
20 UuidTaken(Uuid),
21 #[error("Cannot register reactive entity because entity type {0} is unknown!")]
22 UnknownEntityType(EntityTypeId),
23}
24
25#[derive(Debug, Error)]
26pub enum ReactiveEntityComponentAddError {
27 #[error("Cannot add non-existent component {0} to the reactive entity!")]
28 MissingComponent(ComponentTypeId),
29 #[error("The reactive entity with id {0} doesn't exist!")]
30 MissingInstance(Uuid),
31}
32
33#[derive(Debug, Error)]
34pub enum ReactiveEntityPropertyAddError {
35 #[error("The reactive entity with id {0} doesn't exist!")]
36 MissingInstance(Uuid),
37 #[error("Cannot add property {0} to reactive entity because property already exist!")]
38 PropertyAlreadyExists(String),
39}
40
41#[derive(Debug, Error)]
42pub enum ReactiveEntityPropertyRemoveError {
43 #[error("Cannot remove non-existent property {0} from reactive entity!")]
44 MissingProperty(String),
45 #[error("The reactive entity with id {0} doesn't exist!")]
46 MissingInstance(Uuid),
47 #[error("Cannot remove property {0} from reactive entity because it is in use by component {1}!")]
48 PropertyInUseByComponent(String, ComponentTypeId),
49}