#[non_exhaustive]pub enum RepositoryError {
Show 14 variants
LockPoisoned(&'static str),
Lock(LockError),
ConcurrentWrite {
id: String,
expected: u64,
actual: u64,
},
DuplicateStreamInBatch {
id: String,
},
DuplicateOutboxMessageInBatch {
id: String,
},
DuplicateInboxReceipt {
consumer: String,
message_id: String,
},
InvalidInboxReceipt {
consumer: String,
message_id: String,
},
CausalWriteRequired {
table: String,
},
InvalidStreamIdentity {
aggregate_type: String,
aggregate_id: String,
reason: String,
},
NotFound {
id: String,
},
InvalidState {
id: String,
expected: &'static str,
actual: String,
},
Replay(String),
Model(String),
Storage {
operation: String,
retryable: bool,
source: Option<Box<dyn Error + Send + Sync>>,
},
}Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
LockPoisoned(&'static str)
Lock(LockError)
ConcurrentWrite
DuplicateStreamInBatch
DuplicateOutboxMessageInBatch
DuplicateInboxReceipt
A consumer inbox receipt (consumer, message_id) was already recorded.
The commit is rolled back so the consumer’s effects are not double-applied;
the message has already been processed (an at-least-once replay).
InvalidInboxReceipt
A consumer inbox receipt had an empty consumer or message_id. Rejected
uniformly across backends before any write (the relational CHECK
constraints are a defense-in-depth backstop).
CausalWriteRequired
A raw/legacy repository batch targeted a causal-owned read-model table.
InvalidStreamIdentity
NotFound
InvalidState
Replay(String)
Model(String)
Storage
A storage backend (event store, read model, snapshot store) failed to
complete an operation. Unlike RepositoryError::Model — a deterministic
modeling/decoding fault — this carries an explicit retry classification so
callers can distinguish a transient outage (connection refused, pool
timeout, SQLITE_BUSY) from a deterministic failure (constraint
violation, malformed row) without string-sniffing the message.
The optional source preserves the underlying error for diagnostics and
dead-letter metadata; it is exposed through Error::source.
Implementations§
Source§impl RepositoryError
impl RepositoryError
Sourcepub fn retryable_storage(
operation: impl Into<String>,
source: impl Error + Send + Sync + 'static,
) -> Self
pub fn retryable_storage( operation: impl Into<String>, source: impl Error + Send + Sync + 'static, ) -> Self
Construct a retryable storage failure carrying its source.
Sourcepub fn permanent_storage(
operation: impl Into<String>,
source: impl Error + Send + Sync + 'static,
) -> Self
pub fn permanent_storage( operation: impl Into<String>, source: impl Error + Send + Sync + 'static, ) -> Self
Construct a permanent storage failure carrying its source.
Sourcepub fn kind(&self) -> RetryClass
pub fn kind(&self) -> RetryClass
Classify this error for retry purposes.
The contract a runner relies on: a retryable error should be redelivered (a later attempt may succeed); a permanent error should not, because re-running the identical operation cannot change a deterministic outcome.
Storage { retryable, .. }reports the classification captured when the backend error was mapped (connection/pool/timeout → retryable; constraint/decode → permanent).Lockdefers toLockError::kind.ConcurrentWriteis retryable: an optimistic-concurrency conflict means another writer won the race; reloading and reapplying typically succeeds. This preserves the prior behavior where it fell into the retryable bucket.NotFoundis retryable: under at-least-once delivery it is usually an out-of-order race a later redelivery resolves.- The deterministic faults (
Model,Replay, invalid identity/receipt,InvalidState, duplicate-in-batch,LockPoisoned) are permanent.
Sourcepub fn is_retryable(&self) -> bool
pub fn is_retryable(&self) -> bool
Whether this error is retryable.
Trait Implementations§
Source§impl Debug for RepositoryError
impl Debug for RepositoryError
Source§impl Display for RepositoryError
impl Display for RepositoryError
Source§impl Error for RepositoryError
impl Error for RepositoryError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl From<EventRecordError> for RepositoryError
impl From<EventRecordError> for RepositoryError
Source§fn from(err: EventRecordError) -> Self
fn from(err: EventRecordError) -> Self
Source§impl From<LockError> for RepositoryError
impl From<LockError> for RepositoryError
Source§impl From<RepositoryError> for HandlerError
impl From<RepositoryError> for HandlerError
Source§fn from(err: RepositoryError) -> Self
fn from(err: RepositoryError) -> Self
Source§impl From<RepositoryError> for TransportError
Repository/store failures (lock contention, storage hiccups, stale-claim
conflicts) are retryable: usually transient, resolved by a later re-claim. This
conversion lives with the outbox bridge — which legitimately knows both the
store and the bus — so bus core stays free of RepositoryError.
impl From<RepositoryError> for TransportError
Repository/store failures (lock contention, storage hiccups, stale-claim
conflicts) are retryable: usually transient, resolved by a later re-claim. This
conversion lives with the outbox bridge — which legitimately knows both the
store and the bus — so bus core stays free of RepositoryError.
Source§fn from(error: RepositoryError) -> Self
fn from(error: RepositoryError) -> Self
Source§impl From<RepositoryError> for ProjectionProtocolError
impl From<RepositoryError> for ProjectionProtocolError
Source§fn from(error: RepositoryError) -> Self
fn from(error: RepositoryError) -> Self
Source§impl From<TableStoreError> for RepositoryError
impl From<TableStoreError> for RepositoryError
Source§fn from(err: TableStoreError) -> Self
fn from(err: TableStoreError) -> Self
Auto Trait Implementations§
impl !RefUnwindSafe for RepositoryError
impl !UnwindSafe for RepositoryError
impl Freeze for RepositoryError
impl Send for RepositoryError
impl Sync for RepositoryError
impl Unpin for RepositoryError
impl UnsafeUnpin for RepositoryError
Blanket Implementations§
Source§impl<T> AggregateBuilder for T
impl<T> AggregateBuilder for T
fn aggregate<A: Aggregate>(self) -> AggregateRepository<Self, A>
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Queueable for T
impl<T> Queueable for T
Source§fn queued(self) -> QueuedRepository<Self, InMemoryLockManager>
fn queued(self) -> QueuedRepository<Self, InMemoryLockManager>
.aggregate::<T>() for per-aggregate serialization over the async
repository surface.