Skip to main content

appletheia_application/saga/
saga_runner_error.rs

1use thiserror::Error;
2
3use crate::outbox::command::CommandOutboxEnqueueError;
4use crate::unit_of_work::UnitOfWorkError;
5use crate::unit_of_work::UnitOfWorkFactoryError;
6
7use super::{SagaProcessedEventStoreError, SagaStoreError};
8
9#[derive(Debug, Error)]
10pub enum SagaRunnerError {
11    #[error(transparent)]
12    UnitOfWorkFactory(#[from] UnitOfWorkFactoryError),
13
14    #[error(transparent)]
15    UnitOfWork(#[from] UnitOfWorkError),
16
17    #[error(transparent)]
18    Store(#[from] SagaStoreError),
19
20    #[error(transparent)]
21    ProcessedEventStore(#[from] SagaProcessedEventStoreError),
22
23    #[error(transparent)]
24    CommandOutbox(#[from] CommandOutboxEnqueueError),
25
26    #[error("saga definition error")]
27    Definition(#[source] Box<dyn std::error::Error + Send + Sync>),
28
29    #[error("terminal outcome requires non-empty saga state")]
30    TerminalOutcomeRequiresState,
31}