#[non_exhaustive]pub enum Error {
Workflow(WorkflowError),
Task(TaskError),
Client(ClientError),
Worker(WorkerError),
Actor(String),
Network(String),
Configuration(String),
Serialization(String),
Timeout(String),
Io(Error),
Other(String),
}Expand description
Main error type for the Orcher Rust SDK.
This enum, the per-area enums it wraps, and their variants with named
fields are all #[non_exhaustive]: a new kind of error, or a new detail on
an existing one, is not a breaking change. Match with a wildcard arm and
.. in struct patterns, and build errors with the constructors such as
TaskError::application or ClientError::workflow_not_found.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Workflow(WorkflowError)
Workflow execution error
Task(TaskError)
Task execution error
Client(ClientError)
Client operation error
Worker(WorkerError)
Worker error
Actor(String)
Actor operation error
Network(String)
Network/RPC error
Configuration(String)
Configuration error
Serialization(String)
Serialization/deserialization error
Timeout(String)
Timeout error
Io(Error)
I/O error
Other(String)
Generic error
Implementations§
Source§impl Error
impl Error
Sourcepub fn is_suspend(&self) -> bool
pub fn is_suspend(&self) -> bool
Whether this is the workflow suspension signal rather than a real error.
Suspension is control flow: ctx.execute_task, ctx.execute and timers
return WorkflowError::Suspended to hand control back to the runtime
so it can schedule work and replay the workflow later. Combinators that
inspect errors (sagas, select, retry wrappers) must propagate it
unchanged and never treat it as a failed step.
Sourcepub fn is_retryable(&self) -> bool
pub fn is_retryable(&self) -> bool
Whether this error is transient and may succeed on retry.
Examples are connection failures, timeouts, 5xx and 429 server responses, and task failures not marked non-retryable.
§Example
use orcher_sdk::error::{ClientError, Error};
let error = Error::Client(ClientError::server_error(503, "unavailable"));
assert!(error.is_retryable());
let error = Error::Client(ClientError::server_error(400, "bad request"));
assert!(!error.is_retryable());Sourcepub fn is_permanent(&self) -> bool
pub fn is_permanent(&self) -> bool
Whether this error is permanent, so retrying cannot fix it.
Examples are invalid configuration, authentication failures, non-determinism and 4xx server responses other than 429.
§Example
use orcher_sdk::error::{Error, TaskError};
let error: Error = TaskError::non_retryable("CardDeclined", "card declined").into();
assert!(error.is_permanent());
let error: Error = TaskError::application("Throttled", "slow down").into();
assert!(!error.is_permanent());Sourcepub fn with_context(self, context: impl Into<String>) -> Self
pub fn with_context(self, context: impl Into<String>) -> Self
Wrap this error with a context message.
The result is an Error::Other whose message is "{context}: {self}",
so the original variant is not preserved for matching.
§Example
use orcher_sdk::error::{Error, TaskError};
let error: Error = TaskError::execution_failed("card declined").into();
let error = error.with_context("Failed to execute payment task");
assert!(error.to_string().starts_with("Failed to execute payment task: "));Trait Implementations§
Source§impl Error for Error
impl Error for Error
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<ClientError> for Error
impl From<ClientError> for Error
Source§fn from(source: ClientError) -> Self
fn from(source: ClientError) -> Self
Source§impl From<WorkerError> for Error
impl From<WorkerError> for Error
Source§fn from(source: WorkerError) -> Self
fn from(source: WorkerError) -> Self
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 !RefUnwindSafe for Error
impl !UnwindSafe for Error
impl Forget for Error
impl Freeze for Error
impl Move for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnsafeUnpin for Error
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> 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