disintegrate_postgres/
error.rs

1use std::error::Error as StdError;
2use thiserror::Error;
3
4/// Represents all the ways a method can fail within Disintegrate Postgres.
5#[derive(Error, Debug)]
6pub enum Error {
7    /// Error returned from the database.
8    #[error(transparent)]
9    Database(#[from] sqlx::Error),
10    /// An error occurred while deserializing an event payload.
11    #[error(transparent)]
12    Deserialization(#[from] disintegrate_serde::Error),
13    /// An error occurred while acquiring an append permit.
14    #[error(transparent)]
15    AppendPermit(#[from] tokio::sync::AcquireError),
16    /// An error occurred while mapping the event store event to the query event
17    #[error("unable to map the event store event to the query event: {0}")]
18    QueryEventMapping(#[source] Box<dyn StdError + 'static + Send + Sync>),
19    // An error occurred while attempting to persist events using an outdated version of the event set.
20    ///
21    /// This error indicates that another process has inserted a new event that was not included in the event stream query
22    /// used to make the current business decision. The event store's state has changed, potentially affecting the decision-making process.
23    #[error("concurrent modification error")]
24    Concurrency,
25}