#[non_exhaustive]pub enum EngineError {
Show 17 variants
Store {
message: String,
transient: bool,
},
VersionConflict {
expected: u64,
actual: u64,
},
Deserialization(String),
Serialization(String),
Snapshot {
message: String,
transient: bool,
},
Outbox {
message: String,
transient: bool,
},
Deadline {
message: String,
transient: bool,
},
Registry {
message: String,
transient: bool,
},
Inbox {
message: String,
transient: bool,
},
Partner {
message: String,
transient: bool,
},
DeadLetter {
message: String,
transient: bool,
},
Workflow(WorkflowError),
StreamQuotaExceeded {
stream_id: StreamId,
limit: u64,
new_events: usize,
actual: u64,
},
Transport {
endpoint: Box<str>,
message: String,
},
PartnerUnknown {
recipient: Box<str>,
},
RendererNotImplemented {
message_type: Box<str>,
message_id: Box<str>,
},
InvalidStreamId {
input: Box<str>,
reason: &'static str,
},
}Expand description
Errors that can occur during engine operations (command dispatch, event persistence, state reconstruction).
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Store
The event store returned an error.
Fields
VersionConflict
Optimistic concurrency check failed: the stream was modified by a concurrent writer between the read and the append.
Fields
Deserialization(String)
Could not deserialize a stored event payload into the typed event.
This typically indicates a schema migration is required.
Serialization(String)
Could not serialize a domain event into the envelope payload.
Snapshot
A snapshot storage operation failed.
Fields
Outbox
An outbox storage operation failed.
Fields
Deadline
A deadline storage operation failed.
Fields
Registry
A process registry operation failed.
Fields
Inbox
An inbox (AS4 dedup) operation failed.
Fields
Partner
A partner-store operation failed, or a required partner record is absent.
Fields
DeadLetter
A dead-letter query operation failed.
Covers SlateDbDeadLetterSink::list_recent and similar read-path
operations. Writes are fire-and-forget (logged on error) and do not
produce this variant.
Fields
Workflow(WorkflowError)
The workflow rejected the command or reached an invalid state.
StreamQuotaExceeded
Appending the requested events would exceed the per-stream event count limit configured on the store.
This is a hard safety guard against runaway streams. The caller should archive or compact the stream before retrying.
The stream_id, limit, new_events, and actual fields are
available for internal structured logging but are intentionally not
included in the Display string returned to API callers to avoid
leaking internal stream topology.
Fields
Transport
An AS4 transport send operation failed.
Distinct from Store so the outbox worker can decide retry strategy
without string-matching: transport errors are potentially
transient; serialization errors are permanent.
Fields
PartnerUnknown
The outbound message cannot be delivered because no AS4 endpoint is registered for the recipient GLN.
This is a permanent failure: the operator must add the missing
--as4-partner <GLN>=<URL> entry before delivery can succeed.
The outbox worker should dead-letter immediately rather than retrying.
RendererNotImplemented
The outbound message cannot be rendered to EDIFACT wire format because no renderer is implemented for its message type.
This is a permanent failure: retrying will never succeed until a wire-format renderer is implemented for the message type. The outbox worker should dead-letter the message immediately and alert the operator.
Use this instead of silently transmitting JSON blobs over AS4, which violates BDEW MaKo interoperability requirements.
Fields
InvalidStreamId
A string could not be converted into a valid StreamId.
Stream IDs must be non-empty and must not contain NUL bytes.
This error is produced by StreamId::try_new and the
TryFrom impls. Use the typed constructors
(StreamId::for_process, StreamId::for_partner) where possible
to avoid constructing stream IDs from raw strings.
Implementations§
Source§impl EngineError
impl EngineError
Sourcepub fn store(message: impl Into<String>) -> Self
pub fn store(message: impl Into<String>) -> Self
Construct a permanent (non-retriable) event-store error.
Sourcepub fn transient_store(message: impl Into<String>) -> Self
pub fn transient_store(message: impl Into<String>) -> Self
Construct a transient (retriable) event-store error.
Sourcepub fn transient_outbox(message: impl Into<String>) -> Self
pub fn transient_outbox(message: impl Into<String>) -> Self
Construct a transient outbox-store error.
Sourcepub fn deadline(message: impl Into<String>) -> Self
pub fn deadline(message: impl Into<String>) -> Self
Construct a permanent deadline-store error.
Sourcepub fn transient_deadline(message: impl Into<String>) -> Self
pub fn transient_deadline(message: impl Into<String>) -> Self
Construct a transient deadline-store error.
Sourcepub fn registry(message: impl Into<String>) -> Self
pub fn registry(message: impl Into<String>) -> Self
Construct a permanent process-registry error.
Sourcepub fn transient_registry(message: impl Into<String>) -> Self
pub fn transient_registry(message: impl Into<String>) -> Self
Construct a transient process-registry error.
Sourcepub fn transient_inbox(message: impl Into<String>) -> Self
pub fn transient_inbox(message: impl Into<String>) -> Self
Construct a transient inbox-store error.
Sourcepub fn snapshot(message: impl Into<String>) -> Self
pub fn snapshot(message: impl Into<String>) -> Self
Construct a permanent snapshot-store error.
Sourcepub fn transient_snapshot(message: impl Into<String>) -> Self
pub fn transient_snapshot(message: impl Into<String>) -> Self
Construct a transient snapshot-store error.
Sourcepub fn transient_partner(message: impl Into<String>) -> Self
pub fn transient_partner(message: impl Into<String>) -> Self
Construct a transient partner-store error.
Sourcepub fn dead_letter(message: impl Into<String>) -> Self
pub fn dead_letter(message: impl Into<String>) -> Self
Construct a permanent dead-letter-store error.
Sourcepub fn transient_dead_letter(message: impl Into<String>) -> Self
pub fn transient_dead_letter(message: impl Into<String>) -> Self
Construct a transient dead-letter-store error.
Sourcepub fn is_version_conflict(&self) -> bool
pub fn is_version_conflict(&self) -> bool
Return true when this is a EngineError::VersionConflict.
Useful for retry logic: on a version conflict the caller should reload state and re-issue the command.
Sourcepub fn is_stream_quota_exceeded(&self) -> bool
pub fn is_stream_quota_exceeded(&self) -> bool
Return true when this is a EngineError::StreamQuotaExceeded.
Sourcepub fn is_workflow_error(&self) -> bool
pub fn is_workflow_error(&self) -> bool
Return true when this is a EngineError::Workflow.
Useful for distinguishing infrastructure failures (store errors) from domain rejections (the workflow refused the command).
Sourcepub fn is_transient(&self) -> bool
pub fn is_transient(&self) -> bool
Return true when the error is likely transient and the operation
can be safely retried after a short backoff.
Storage errors carry an explicit transient flag set at the point of
construction by the storage layer, eliminating any reliance on
string-matching heuristics.
Transport errors (network timeouts, TLS failures) are always transient. All other errors (version conflicts, quota exceeded, workflow rejections, …) are permanent.
§Usage
for attempt in 0..MAX_RETRIES {
match process.execute(cmd.clone()).await {
Ok(result) => return Ok(result),
Err(e) if e.is_version_conflict() => { /* reload and retry */ }
Err(e) if e.is_transient() => {
tokio::time::sleep(backoff(attempt)).await;
}
Err(e) => return Err(e),
}
}Sourcepub fn is_partner_unknown(&self) -> bool
pub fn is_partner_unknown(&self) -> bool
Return true when this is a EngineError::PartnerUnknown.
PartnerUnknown is a permanent failure: no retry will succeed until
the operator registers the missing --as4-partner entry. The outbox
worker should dead-letter the message immediately.
Sourcepub fn is_renderer_not_implemented(&self) -> bool
pub fn is_renderer_not_implemented(&self) -> bool
Return true when this is a EngineError::RendererNotImplemented.
RendererNotImplemented is a permanent failure: no retry will
succeed until a wire-format renderer is implemented for the message type.
The outbox worker should dead-letter the message immediately.
Sourcepub fn is_transport_error(&self) -> bool
pub fn is_transport_error(&self) -> bool
Return true when this is a EngineError::Transport.
Sourcepub fn as_workflow_error(&self) -> Option<&WorkflowError>
pub fn as_workflow_error(&self) -> Option<&WorkflowError>
Return the inner WorkflowError if this is a workflow rejection,
or None otherwise.
Sourcepub fn is_snapshot_error(&self) -> bool
pub fn is_snapshot_error(&self) -> bool
Return true when this is a EngineError::Snapshot.
Sourcepub fn is_outbox_error(&self) -> bool
pub fn is_outbox_error(&self) -> bool
Return true when this is a EngineError::Outbox.
Sourcepub fn is_deadline_error(&self) -> bool
pub fn is_deadline_error(&self) -> bool
Return true when this is a EngineError::Deadline.
Sourcepub fn is_registry_error(&self) -> bool
pub fn is_registry_error(&self) -> bool
Return true when this is a EngineError::Registry.
Sourcepub fn is_inbox_error(&self) -> bool
pub fn is_inbox_error(&self) -> bool
Return true when this is a EngineError::Inbox.
Trait Implementations§
Source§impl Debug for EngineError
impl Debug for EngineError
Source§impl Display for EngineError
impl Display for EngineError
Source§impl Error for EngineError
impl Error for EngineError
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()