1use thiserror::Error;
4
5use crate::types::EntityId;
6
7#[derive(Debug, Error)]
9pub enum RepositoryError {
10 #[error("{entity} id {id} already in use")]
12 DuplicateId { entity: &'static str, id: EntityId },
13
14 #[error("{operation}: child entities do not exist: {ids:?}")]
16 MissingRelationshipTarget {
17 operation: &'static str,
18 ids: Vec<EntityId>,
19 },
20
21 #[error("serialization error: {0}")]
23 Serialization(String),
24
25 #[error("constraint violation: {0}")]
27 ConstraintViolation(String),
28
29 #[error(transparent)]
31 Other(#[from] anyhow::Error),
32}