pub struct WorkflowError { /* private fields */ }Expand description
Runtime error for the Serverless Workflow engine
Implementations§
Source§impl WorkflowError
impl WorkflowError
Sourcepub fn fields(&self) -> &ErrorFields
pub fn fields(&self) -> &ErrorFields
Returns a reference to the error fields
Sourcepub fn validation(message: impl Into<String>, task: impl Into<String>) -> Self
pub fn validation(message: impl Into<String>, task: impl Into<String>) -> Self
Creates a validation error
Sourcepub fn expression(message: impl Into<String>, task: impl Into<String>) -> Self
pub fn expression(message: impl Into<String>, task: impl Into<String>) -> Self
Creates an expression error
Sourcepub fn runtime(
message: impl Into<String>,
task: impl Into<String>,
instance: impl Into<String>,
) -> Self
pub fn runtime( message: impl Into<String>, task: impl Into<String>, instance: impl Into<String>, ) -> Self
Creates a runtime error
Sourcepub fn runtime_simple(
message: impl Into<String>,
task: impl Into<String>,
) -> Self
pub fn runtime_simple( message: impl Into<String>, task: impl Into<String>, ) -> Self
Creates a runtime error without an instance (defaults to empty string)
Sourcepub fn timeout(message: impl Into<String>, task: impl Into<String>) -> Self
pub fn timeout(message: impl Into<String>, task: impl Into<String>) -> Self
Creates a timeout error Per the Serverless Workflow spec, timeout errors have status 408
Sourcepub fn communication(
message: impl Into<String>,
task: impl Into<String>,
) -> Self
pub fn communication( message: impl Into<String>, task: impl Into<String>, ) -> Self
Creates a communication error
Sourcepub fn communication_with_status(
message: impl Into<String>,
task: impl Into<String>,
status_code: u16,
) -> Self
pub fn communication_with_status( message: impl Into<String>, task: impl Into<String>, status_code: u16, ) -> Self
Creates a communication error with an HTTP status code
Sourcepub fn typed(
error_type: &str,
detail: String,
task: String,
instance: String,
status: Option<Value>,
title: Option<String>,
) -> Self
pub fn typed( error_type: &str, detail: String, task: String, instance: String, status: Option<Value>, title: Option<String>, ) -> Self
Creates a typed error from DSL error definition fields
Sourcepub fn error_type(&self) -> &str
pub fn error_type(&self) -> &str
Returns the error type as a full URI (prefers original type from DSL if available)
Sourcepub fn error_type_short(&self) -> &str
pub fn error_type_short(&self) -> &str
Returns the short error type name (last segment of URI)
Sourcepub fn to_value(&self) -> Value
pub fn to_value(&self) -> Value
Converts the error to a JSON Value for use in expressions (e.g., $caughtError)
Sourcepub fn with_instance(self, instance: impl Into<String>) -> Self
pub fn with_instance(self, instance: impl Into<String>) -> Self
Sets the instance reference on the error if not already set
Trait Implementations§
Source§impl Clone for WorkflowError
impl Clone for WorkflowError
Source§fn clone(&self) -> WorkflowError
fn clone(&self) -> WorkflowError
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§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()
Auto Trait Implementations§
impl Freeze 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
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> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.