#[non_exhaustive]pub enum OutboxError {
Serialization(Error),
Database(Box<dyn Error + Send + Sync>),
MissingHandler {
event_type: String,
},
MaxRetries {
event_id: Uuid,
attempts: u32,
},
TypeMismatch {
expected: &'static str,
actual: String,
},
PoolTimeout,
DispatchTimeout {
event_id: Uuid,
event_type: String,
timeout: Duration,
},
Internal(String),
}Expand description
Errors raised by the outbox primitives, publishers and workers.
Marked #[non_exhaustive] so new variants can be added without a
breaking change.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Serialization(Error)
The event payload could not be serialized or deserialized as JSON.
Database(Box<dyn Error + Send + Sync>)
The backend reported a database-level failure.
The original error is preserved as a boxed source so callers can downcast if they need typed access to the underlying driver error.
MissingHandler
The worker polled an envelope whose event_type has no registered handler.
MaxRetries
Reserved for future use. Not constructed by the current outbox worker implementation.
The worker today leaves exhausted events in the table (where they
are excluded from future polls by the attempts < max_attempts
predicate) or moves them to the dead-letter table when one is
configured. This variant is kept in the enum so a future release
can expose exhaustion as a typed error without a breaking change.
Do not match on it expecting to observe it in normal operation.
Fields
TypeMismatch
An envelope was decoded into the wrong event type.
Returned when a caller invokes crate::OutboxEnvelope::decode
with a type whose crate::Event::EVENT_TYPE does not match the
envelope’s event_type field. Typically the sign of a
router or registry misconfiguration on the caller side.
Fields
PoolTimeout
The connection pool did not yield a connection within the configured timeout.
This is a transient condition: the pool is under pressure but the
database itself may be healthy. The outbox worker retries automatically
after OutboxWorkerConfig::poll_interval. Application code that
observes this variant can implement back-pressure or circuit-breaking.
To prevent indefinite blocking, configure an acquire timeout on the
pool (e.g. sqlx::pool::PoolOptions::acquire_timeout).
DispatchTimeout
The handler did not complete within
OutboxWorkerConfig::dispatch_timeout.
The worker enforces dispatch_timeout as a hard deadline around each
handler invocation. When it elapses the dispatch is treated as a failed
attempt (recorded via crate::OutboxStore::mark_failed and retried or
dead-lettered like any other error) and the handler’s cancellation token
is signalled so cooperative handlers can unwind.
Fields
Internal(String)
An invariant of the outbox machinery was violated.
Signals a bug in the framework itself, not a recoverable error. Report occurrences upstream.
Trait Implementations§
Source§impl Debug for OutboxError
impl Debug for OutboxError
Source§impl Display for OutboxError
impl Display for OutboxError
Source§impl Error for OutboxError
impl Error for OutboxError
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()