#[non_exhaustive]pub enum WorkflowError {
Show 17 variants
#[non_exhaustive] TaskFailed {
task_type: String,
attempts: u32,
reason: String,
error_type: String,
code: TaskFailureCode,
},
#[non_exhaustive] TimerFailed {
timer_id: String,
reason: String,
},
#[non_exhaustive] ChildWorkflowFailed {
workflow_type: String,
workflow_id: String,
reason: String,
},
StateError(String),
Canceled,
#[non_exhaustive] Timeout {
timeout: Duration,
},
Panic(String),
NonDeterministic(String),
#[non_exhaustive] EventError {
event: String,
reason: String,
},
#[non_exhaustive] QueryError {
query: String,
reason: String,
},
#[non_exhaustive] CompensationFailed {
failed: Vec<String>,
reason: String,
step_failure: Option<String>,
},
InvalidState(String),
#[non_exhaustive] NotFound {
workflow_id: String,
},
ReplayError(String),
RestartFreshError(String),
#[non_exhaustive] VersionMismatch {
expected: String,
actual: String,
},
#[non_exhaustive] Suspended {
reason: String,
pending_operations: Vec<String>,
},
}Expand description
Errors that can occur during workflow execution.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
#[non_exhaustive]TaskFailed
A task executed by the workflow failed
Fields
This variant is marked as non-exhaustive
error_type: StringThe failure’s type, as a retry policy’s non-retryable list names it:
the error_type of a TaskError::application failure, for
example. Empty for a failure of no particular type.
code: TaskFailureCodeThe failure’s category: whether the task’s code raised it, it was cancelled, or it timed out.
#[non_exhaustive]TimerFailed
A timer operation failed
Fields
This variant is marked as non-exhaustive
#[non_exhaustive]ChildWorkflowFailed
A child workflow failed
Fields
This variant is marked as non-exhaustive
StateError(String)
Workflow state management error
Canceled
Workflow was canceled
#[non_exhaustive]Timeout
Workflow timed out
Fields
This variant is marked as non-exhaustive
Panic(String)
Workflow panicked
NonDeterministic(String)
Workflow execution is not deterministic
#[non_exhaustive]EventError
Event handling error
Fields
This variant is marked as non-exhaustive
#[non_exhaustive]QueryError
Query handling error
Fields
This variant is marked as non-exhaustive
#[non_exhaustive]CompensationFailed
A saga’s compensations ran, and at least one of them failed.
Every compensation still runs when one fails; this reports the ones
that failed once all have run. Returned by Saga::compensate, and by
a failed saga step whose compensating failed, which then carries the
step’s own failure in step_failure.
Fields
This variant is marked as non-exhaustive
InvalidState(String)
Invalid workflow state
#[non_exhaustive]NotFound
Workflow not found
Fields
This variant is marked as non-exhaustive
ReplayError(String)
Replay error
RestartFreshError(String)
Restarting the workflow fresh failed.
#[non_exhaustive]VersionMismatch
Version mismatch error
Fields
This variant is marked as non-exhaustive
#[non_exhaustive]Suspended
The workflow is waiting for operations it started to complete.
This is control flow, not a failure. A workflow returns it when it calls
ctx.execute() and the result is not available yet. The workflow executor
catches it, sends the pending commands to the server, and replays the
workflow once results arrive. See Error::is_suspend.
Fields
This variant is marked as non-exhaustive
Implementations§
Source§impl WorkflowError
impl WorkflowError
Sourcepub fn task_failed(
task_type: impl Into<String>,
attempts: u32,
reason: impl Into<String>,
) -> Self
pub fn task_failed( task_type: impl Into<String>, attempts: u32, reason: impl Into<String>, ) -> Self
Create a task failed error
Sourcepub fn with_failure_type(
self,
error_type: impl Into<String>,
code: TaskFailureCode,
) -> Self
pub fn with_failure_type( self, error_type: impl Into<String>, code: TaskFailureCode, ) -> Self
Sets a TaskFailed error’s type and category; any
other error is returned as it is.
Sourcepub fn task_failure_code(&self) -> Option<TaskFailureCode>
pub fn task_failure_code(&self) -> Option<TaskFailureCode>
The category of a TaskFailed error, or None for
any other error.
Sourcepub fn task_failure_type(&self) -> Option<&str>
pub fn task_failure_type(&self) -> Option<&str>
The type of a TaskFailed error, or None for any
other error. Empty for a failure of no particular type.
Sourcepub fn is_task_cancelled(&self) -> bool
pub fn is_task_cancelled(&self) -> bool
Whether this is a TaskFailed error for a task that
was cancelled: its category is TaskFailureCode::Cancelled, or its
type is Cancelled, which is how an engine that does not categorize
failures records a cancellation.
Sourcepub fn timer_failed(
timer_id: impl Into<String>,
reason: impl Into<String>,
) -> Self
pub fn timer_failed( timer_id: impl Into<String>, reason: impl Into<String>, ) -> Self
Create a timer failed error
Sourcepub fn child_workflow_failed(
workflow_type: impl Into<String>,
workflow_id: impl Into<String>,
reason: impl Into<String>,
) -> Self
pub fn child_workflow_failed( workflow_type: impl Into<String>, workflow_id: impl Into<String>, reason: impl Into<String>, ) -> Self
Create a child workflow failed error
Sourcepub fn event_error(event: impl Into<String>, reason: impl Into<String>) -> Self
pub fn event_error(event: impl Into<String>, reason: impl Into<String>) -> Self
Create an event error
Sourcepub fn query_error(query: impl Into<String>, reason: impl Into<String>) -> Self
pub fn query_error(query: impl Into<String>, reason: impl Into<String>) -> Self
Create a query error
Sourcepub fn non_deterministic(reason: impl Into<String>) -> Self
pub fn non_deterministic(reason: impl Into<String>) -> Self
Create a non-deterministic error
Trait Implementations§
Source§impl Clone for WorkflowError
impl Clone for WorkflowError
Source§impl Debug for WorkflowError
impl Debug for WorkflowError
Source§impl Display for WorkflowError
impl Display for WorkflowError
Source§impl Error for WorkflowError
impl Error for WorkflowError
1.30.0 · 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<WorkflowError> for Error
impl From<WorkflowError> for Error
Source§fn from(source: WorkflowError) -> Self
fn from(source: WorkflowError) -> Self
Auto Trait Implementations§
impl Forget for WorkflowError
impl Freeze for WorkflowError
impl Move for WorkflowError
impl RefUnwindSafe for WorkflowError
impl Send for WorkflowError
impl Sync for WorkflowError
impl Unpin for WorkflowError
impl UnsafeUnpin for WorkflowError
impl UnwindSafe for WorkflowError
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request