Skip to main content

yarli_cli/yarli-store/src/
error.rs

1//! Error types for yarli-store.
2
3use thiserror::Error;
4use uuid::Uuid;
5
6/// Errors from event store operations.
7#[derive(Debug, Error)]
8pub enum StoreError {
9    /// An event with this idempotency key already exists.
10    #[error("duplicate idempotency key: {0}")]
11    DuplicateIdempotencyKey(String),
12
13    /// An event with this ID already exists.
14    #[error("duplicate event ID: {0}")]
15    DuplicateEventId(Uuid),
16
17    /// Event not found.
18    #[error("event not found: {0}")]
19    EventNotFound(Uuid),
20
21    /// Serialization error.
22    #[error("serialization error: {0}")]
23    Serialization(#[from] serde_json::Error),
24
25    /// Database operation failed.
26    #[error("database error: {0}")]
27    Database(String),
28
29    /// Tokio runtime operation failed.
30    #[error("runtime error: {0}")]
31    Runtime(String),
32
33    /// Persisted entity type value is invalid.
34    #[error("invalid entity type in store: {0}")]
35    InvalidEntityType(String),
36}