#[non_exhaustive]pub enum DurableError {
Show 17 variants
#[non_exhaustive] ReplayMismatch {
expected: String,
actual: String,
position: usize,
},
#[non_exhaustive] CheckpointFailed {
operation_name: String,
source: Box<dyn Error + Send + Sync>,
},
#[non_exhaustive] Serialization {
type_name: String,
source: Error,
},
#[non_exhaustive] Deserialization {
type_name: String,
source: Error,
},
AwsSdk(Box<Error>),
AwsSdkOperation(Box<dyn Error + Send + Sync>),
#[non_exhaustive] StepRetryScheduled {
operation_name: String,
},
#[non_exhaustive] WaitSuspended {
operation_name: String,
},
#[non_exhaustive] CallbackSuspended {
operation_name: String,
callback_id: String,
},
#[non_exhaustive] CallbackFailed {
operation_name: String,
callback_id: String,
error_message: String,
},
#[non_exhaustive] InvokeSuspended {
operation_name: String,
},
#[non_exhaustive] InvokeFailed {
operation_name: String,
error_message: String,
},
#[non_exhaustive] ParallelFailed {
operation_name: String,
error_message: String,
},
#[non_exhaustive] MapFailed {
operation_name: String,
error_message: String,
},
#[non_exhaustive] ChildContextFailed {
operation_name: String,
error_message: String,
},
#[non_exhaustive] StepTimeout {
operation_name: String,
},
#[non_exhaustive] CompensationFailed {
operation_name: String,
error_message: String,
},
}Expand description
Represent all errors that can occur within the durable-lambda SDK.
Each variant carries rich context for diagnosing failures. Variants
are constructed via static methods (e.g., DurableError::replay_mismatch)
to keep internal fields private.
§Examples
use durable_lambda_core::error::DurableError;
// Create a replay mismatch error.
let err = DurableError::replay_mismatch("Step", "Wait", 3);
assert!(err.to_string().contains("position 3"));
assert!(err.to_string().contains("expected Step"));Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
#[non_exhaustive]ReplayMismatch
A replay operation encountered a different operation type or name than what was recorded in the execution history.
Fields
This variant is marked as non-exhaustive
#[non_exhaustive]CheckpointFailed
A checkpoint write or read operation failed.
Fields
This variant is marked as non-exhaustive
#[non_exhaustive]Serialization
Serialization of a value to JSON failed.
Fields
This variant is marked as non-exhaustive
#[non_exhaustive]Deserialization
Deserialization of a value from JSON failed.
Fields
This variant is marked as non-exhaustive
AwsSdk(Box<Error>)
A general AWS SDK error occurred.
AwsSdkOperation(Box<dyn Error + Send + Sync>)
A specific AWS API operation error occurred.
#[non_exhaustive]StepRetryScheduled
A step retry has been scheduled — the function should exit.
The SDK has checkpointed a RETRY action. The durable execution server will re-invoke the Lambda after the configured delay. The handler must propagate this error to exit cleanly.
Fields
This variant is marked as non-exhaustive
#[non_exhaustive]WaitSuspended
A wait operation has been checkpointed — the function should exit.
The SDK has sent a START checkpoint with the wait duration. The durable execution server will re-invoke the Lambda after the timer expires. The handler must propagate this error to exit cleanly.
Fields
This variant is marked as non-exhaustive
#[non_exhaustive]CallbackSuspended
A callback is pending — the function should exit and wait for an external signal.
The callback has been registered but no success/failure signal has been received yet. The handler must propagate this error to exit. The server will re-invoke the Lambda when the callback is signaled.
Fields
This variant is marked as non-exhaustive
#[non_exhaustive]CallbackFailed
A callback failed, was cancelled, or timed out.
The external system signaled failure, or the callback exceeded its configured timeout. The error message contains details from the callback’s error object.
Fields
This variant is marked as non-exhaustive
#[non_exhaustive]InvokeSuspended
An invoke operation is pending — the function should exit while the target Lambda executes.
The invoke START checkpoint has been sent. The server will invoke the target function asynchronously and re-invoke this Lambda when the target completes.
Fields
This variant is marked as non-exhaustive
#[non_exhaustive]InvokeFailed
An invoke operation failed, timed out, or was stopped.
The target Lambda function returned an error, or the invoke exceeded its configured timeout.
Fields
This variant is marked as non-exhaustive
#[non_exhaustive]ParallelFailed
A parallel operation failed.
One or more branches encountered an unrecoverable error during concurrent execution.
Fields
This variant is marked as non-exhaustive
#[non_exhaustive]MapFailed
A map operation failed.
An unrecoverable error occurred during map collection processing.
Individual item failures are captured in the BatchResult
rather than propagated as this error.
Fields
This variant is marked as non-exhaustive
#[non_exhaustive]ChildContextFailed
A child context operation failed.
The child context’s closure returned an error, or the child context was found in a failed/cancelled/timed-out state during replay.
§Examples
use durable_lambda_core::error::DurableError;
let err = DurableError::child_context_failed("sub_workflow", "closure returned error");
assert!(err.to_string().contains("sub_workflow"));
assert!(err.to_string().contains("closure returned error"));Fields
This variant is marked as non-exhaustive
#[non_exhaustive]StepTimeout
A step exceeded its configured timeout.
The step closure did not complete within the duration configured via
StepOptions::timeout_seconds.
The spawned task is aborted and this error is returned immediately.
§Examples
use durable_lambda_core::error::DurableError;
let err = DurableError::step_timeout("my_op");
assert!(err.to_string().contains("my_op"));
assert!(err.to_string().contains("timed out"));
assert_eq!(err.code(), "STEP_TIMEOUT");Fields
This variant is marked as non-exhaustive
#[non_exhaustive]CompensationFailed
One or more compensation steps failed during saga rollback.
The saga/compensation pattern ran run_compensations() and one or more
compensation closures returned an error. All compensations are attempted
regardless; this error captures the first/combined failure.
§Examples
use durable_lambda_core::error::DurableError;
let err = DurableError::compensation_failed("charge_payment", "payment reversal failed");
assert!(err.to_string().contains("charge_payment"));
assert!(err.to_string().contains("payment reversal failed"));
assert_eq!(err.code(), "COMPENSATION_FAILED");Implementations§
Source§impl DurableError
impl DurableError
Sourcepub fn replay_mismatch(
expected: impl Into<String>,
actual: impl Into<String>,
position: usize,
) -> DurableError
pub fn replay_mismatch( expected: impl Into<String>, actual: impl Into<String>, position: usize, ) -> DurableError
Create a replay mismatch error.
Use when the replay engine encounters an operation at a history position that doesn’t match the expected operation type or name.
§Examples
use durable_lambda_core::error::DurableError;
let err = DurableError::replay_mismatch("Step", "Wait", 5);
assert!(err.to_string().contains("expected Step"));
assert!(err.to_string().contains("got Wait"));
assert!(err.to_string().contains("position 5"));Sourcepub fn checkpoint_failed(
operation_name: impl Into<String>,
source: impl Error + Send + Sync + 'static,
) -> DurableError
pub fn checkpoint_failed( operation_name: impl Into<String>, source: impl Error + Send + Sync + 'static, ) -> DurableError
Create a checkpoint failure error.
Use when writing or reading a checkpoint to/from the durable execution backend fails.
§Examples
use durable_lambda_core::error::DurableError;
use std::io;
let source = io::Error::new(io::ErrorKind::TimedOut, "connection timed out");
let err = DurableError::checkpoint_failed("charge_payment", source);
assert!(err.to_string().contains("charge_payment"));Sourcepub fn serialization(
type_name: impl Into<String>,
source: Error,
) -> DurableError
pub fn serialization( type_name: impl Into<String>, source: Error, ) -> DurableError
Create a serialization error.
Use when serde_json::to_value or serde_json::to_string fails
for a checkpoint value.
§Examples
use durable_lambda_core::error::DurableError;
// Simulate a serde error by deserializing invalid JSON.
let serde_err = serde_json::from_str::<i32>("not a number").unwrap_err();
let err = DurableError::serialization("OrderPayload", serde_err);
assert!(err.to_string().contains("OrderPayload"));Sourcepub fn deserialization(
type_name: impl Into<String>,
source: Error,
) -> DurableError
pub fn deserialization( type_name: impl Into<String>, source: Error, ) -> DurableError
Create a deserialization error.
Use when serde_json::from_value or serde_json::from_str fails
for a cached checkpoint value during replay.
§Examples
use durable_lambda_core::error::DurableError;
// Simulate a serde error by deserializing invalid JSON.
let serde_err = serde_json::from_str::<i32>("not a number").unwrap_err();
let err = DurableError::deserialization("OrderResult", serde_err);
assert!(err.to_string().contains("OrderResult"));
assert!(err.to_string().contains("deserialize"));Sourcepub fn aws_sdk_operation(
source: impl Error + Send + Sync + 'static,
) -> DurableError
pub fn aws_sdk_operation( source: impl Error + Send + Sync + 'static, ) -> DurableError
Create an AWS API operation error.
Use for specific AWS API call failures (e.g., SdkError from
individual operations) that are distinct from the general
aws_sdk_lambda::Error.
§Examples
use durable_lambda_core::error::DurableError;
use std::io;
let source = io::Error::new(io::ErrorKind::Other, "service unavailable");
let err = DurableError::aws_sdk_operation(source);
assert!(err.to_string().contains("service unavailable"));Sourcepub fn step_retry_scheduled(operation_name: impl Into<String>) -> DurableError
pub fn step_retry_scheduled(operation_name: impl Into<String>) -> DurableError
Create a step retry scheduled signal.
Use when a step has been checkpointed with RETRY and the function should exit so the server can re-invoke after the configured delay.
§Examples
use durable_lambda_core::error::DurableError;
let err = DurableError::step_retry_scheduled("charge_payment");
assert!(err.to_string().contains("charge_payment"));Sourcepub fn wait_suspended(operation_name: impl Into<String>) -> DurableError
pub fn wait_suspended(operation_name: impl Into<String>) -> DurableError
Create a wait suspended signal.
Use when a wait operation has been checkpointed with START and the function should exit so the server can re-invoke after the timer.
§Examples
use durable_lambda_core::error::DurableError;
let err = DurableError::wait_suspended("cooldown_delay");
assert!(err.to_string().contains("cooldown_delay"));Sourcepub fn callback_suspended(
operation_name: impl Into<String>,
callback_id: impl Into<String>,
) -> DurableError
pub fn callback_suspended( operation_name: impl Into<String>, callback_id: impl Into<String>, ) -> DurableError
Create a callback suspended signal.
Use when a callback has been registered but not yet signaled. The handler must propagate this to exit so the server can wait for the external signal.
§Examples
use durable_lambda_core::error::DurableError;
let err = DurableError::callback_suspended("approval", "cb-123");
assert!(err.to_string().contains("approval"));
assert!(err.to_string().contains("cb-123"));Sourcepub fn callback_failed(
operation_name: impl Into<String>,
callback_id: impl Into<String>,
error_message: impl Into<String>,
) -> DurableError
pub fn callback_failed( operation_name: impl Into<String>, callback_id: impl Into<String>, error_message: impl Into<String>, ) -> DurableError
Create a callback failed error.
Use when a callback was signaled with failure, cancelled, or timed out.
§Examples
use durable_lambda_core::error::DurableError;
let err = DurableError::callback_failed("approval", "cb-123", "rejected by reviewer");
assert!(err.to_string().contains("approval"));
assert!(err.to_string().contains("cb-123"));
assert!(err.to_string().contains("rejected by reviewer"));Sourcepub fn invoke_suspended(operation_name: impl Into<String>) -> DurableError
pub fn invoke_suspended(operation_name: impl Into<String>) -> DurableError
Create an invoke suspended signal.
Use when an invoke START checkpoint has been sent and the function should exit while the target Lambda executes.
§Examples
use durable_lambda_core::error::DurableError;
let err = DurableError::invoke_suspended("call_processor");
assert!(err.to_string().contains("call_processor"));Sourcepub fn invoke_failed(
operation_name: impl Into<String>,
error_message: impl Into<String>,
) -> DurableError
pub fn invoke_failed( operation_name: impl Into<String>, error_message: impl Into<String>, ) -> DurableError
Create an invoke failed error.
Use when the target Lambda returned an error, timed out, or was stopped.
§Examples
use durable_lambda_core::error::DurableError;
let err = DurableError::invoke_failed("call_processor", "target function timed out");
assert!(err.to_string().contains("call_processor"));
assert!(err.to_string().contains("timed out"));Sourcepub fn parallel_failed(
operation_name: impl Into<String>,
error_message: impl Into<String>,
) -> DurableError
pub fn parallel_failed( operation_name: impl Into<String>, error_message: impl Into<String>, ) -> DurableError
Create a parallel failed error.
Use when a parallel operation encounters an unrecoverable error.
§Examples
use durable_lambda_core::error::DurableError;
let err = DurableError::parallel_failed("fan_out", "branch 2 panicked");
assert!(err.to_string().contains("fan_out"));Sourcepub fn map_failed(
operation_name: impl Into<String>,
error_message: impl Into<String>,
) -> DurableError
pub fn map_failed( operation_name: impl Into<String>, error_message: impl Into<String>, ) -> DurableError
Create a map failed error.
Use when a map operation encounters an unrecoverable error (e.g.,
checkpoint failure, task panic). Individual item failures are captured
in BatchResult, not as this error.
§Examples
use durable_lambda_core::error::DurableError;
let err = DurableError::map_failed("process_orders", "item 3 panicked");
assert!(err.to_string().contains("process_orders"));
assert!(err.to_string().contains("item 3 panicked"));Sourcepub fn child_context_failed(
operation_name: impl Into<String>,
error_message: impl Into<String>,
) -> DurableError
pub fn child_context_failed( operation_name: impl Into<String>, error_message: impl Into<String>, ) -> DurableError
Create a child context failed error.
Use when a child context operation fails during execution or is found in a failed state during replay.
§Examples
use durable_lambda_core::error::DurableError;
let err = DurableError::child_context_failed("sub_workflow", "closure returned error");
assert!(err.to_string().contains("sub_workflow"));
assert!(err.to_string().contains("closure returned error"));Sourcepub fn step_timeout(operation_name: impl Into<String>) -> DurableError
pub fn step_timeout(operation_name: impl Into<String>) -> DurableError
Create a step timeout error.
Use when a step closure exceeds the configured timeout_seconds duration.
§Examples
use durable_lambda_core::error::DurableError;
let err = DurableError::step_timeout("my_op");
assert!(err.to_string().contains("my_op"));
assert_eq!(err.code(), "STEP_TIMEOUT");Sourcepub fn compensation_failed(
operation_name: impl Into<String>,
error_message: impl Into<String>,
) -> DurableError
pub fn compensation_failed( operation_name: impl Into<String>, error_message: impl Into<String>, ) -> DurableError
Create a compensation failed error.
Use when one or more compensation closures in run_compensations() fail.
All compensations are attempted even when one fails; this error is returned
when the CompensationResult shows failures.
§Examples
use durable_lambda_core::error::DurableError;
let err = DurableError::compensation_failed("charge_payment", "reversal failed");
assert!(err.to_string().contains("charge_payment"));
assert_eq!(err.code(), "COMPENSATION_FAILED");Sourcepub fn code(&self) -> &'static str
pub fn code(&self) -> &'static str
Return a stable, programmatic error code for this error variant.
Codes are SCREAMING_SNAKE_CASE and stable across versions. Use these for programmatic error matching instead of parsing display messages.
§Examples
use durable_lambda_core::error::DurableError;
let err = DurableError::replay_mismatch("Step", "Wait", 0);
assert_eq!(err.code(), "REPLAY_MISMATCH");Trait Implementations§
Source§impl Debug for DurableError
impl Debug for DurableError
Source§impl Display for DurableError
impl Display for DurableError
Source§impl Error for DurableError
impl Error for DurableError
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<Error> for DurableError
impl From<Error> for DurableError
Source§fn from(err: Error) -> DurableError
fn from(err: Error) -> DurableError
Auto Trait Implementations§
impl Freeze for DurableError
impl !RefUnwindSafe for DurableError
impl Send for DurableError
impl Sync for DurableError
impl Unpin for DurableError
impl UnsafeUnpin for DurableError
impl !UnwindSafe for DurableError
Blanket Implementations§
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more