use thiserror::Error;
use crate::types::EntityId;
#[derive(Debug, Error)]
pub enum RepositoryError {
#[error("{entity} id {id} already in use")]
DuplicateId { entity: &'static str, id: EntityId },
#[error("{operation}: child entities do not exist: {ids:?}")]
MissingRelationshipTarget {
operation: &'static str,
ids: Vec<EntityId>,
},
#[error("serialization error: {0}")]
Serialization(String),
#[error("constraint violation: {0}")]
ConstraintViolation(String),
#[error(transparent)]
Other(#[from] anyhow::Error),
}