#[non_exhaustive]pub enum DataflowError {
Validation(String),
FunctionExecution {
context: String,
source: Option<Box<DataflowError>>,
},
Workflow(String),
Task(String),
FunctionNotFound(String),
Deserialization(String),
Io(String),
LogicEvaluation(String),
Http {
status: u16,
message: String,
},
Timeout(String),
Unknown(String),
Service {
kind: String,
message: String,
detail: Option<String>,
retryable: bool,
},
}Expand description
Main error type for the dataflow engine
#[non_exhaustive]: a downstream match needs a wildcard arm. Adding it here
makes every future variant additive rather than a breaking change, which
matters because this enum is the crate’s error channel and will keep growing.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Validation(String)
Validation errors occurring during rule evaluation
FunctionExecution
Errors during function execution
Workflow(String)
Workflow-related errors
Task(String)
Task-related errors
FunctionNotFound(String)
Function not found errors
Deserialization(String)
JSON serialization/deserialization errors
Io(String)
I/O errors (file reading, etc.)
LogicEvaluation(String)
JSONLogic/DataLogic evaluation errors
Http
HTTP request errors
Timeout(String)
Timeout errors
Unknown(String)
Any other errors
Service
A failure the service layer classifies itself.
The engine never interprets kind: it carries it to ErrorInfo::code
and otherwise treats this exactly like any other error —
continue_on_error, the audit-trail entry and the Result::Err
short-circuit are unchanged. No built-in returns this variant.
Display renders message alone, so to_string() is always safe to hand
to an untrusted caller. detail is reachable only through Debug,
DataflowError::detail and ErrorInfo::detail.
Build it with DataflowError::service.
Implementations§
Source§impl DataflowError
impl DataflowError
Sourcepub fn function_execution<S: Into<String>>(
context: S,
source: Option<DataflowError>,
) -> Self
pub fn function_execution<S: Into<String>>( context: S, source: Option<DataflowError>, ) -> Self
Creates a new function execution error with context
Sourcepub fn from_serde(err: Error) -> Self
pub fn from_serde(err: Error) -> Self
Convert from serde_json::Error
Sourcepub fn retryable(&self) -> bool
pub fn retryable(&self) -> bool
Determines if this error is retryable (worth retrying)
Retryable errors are typically transient infrastructure failures that might succeed on retry. Non-retryable errors are typically data validation, logic, or configuration errors that will consistently fail on retry.
Sourcepub fn kind(&self) -> Option<&str>
pub fn kind(&self) -> Option<&str>
The service-owned classification, or None for every engine-owned
variant.
This is the whole point of DataflowError::Service: a handler can
classify its own failures with a stable code the engine never interprets.
Sourcepub fn detail(&self) -> Option<&str>
pub fn detail(&self) -> Option<&str>
Operator-only detail, if this is a DataflowError::Service carrying one.
Never included in Display, so to_string() stays safe to hand to an
untrusted caller. Reachable through Debug, this method, and
ErrorInfo::detail.
Sourcepub fn service(
kind: impl Into<String>,
message: impl Into<String>,
) -> ServiceErrorBuilder
pub fn service( kind: impl Into<String>, message: impl Into<String>, ) -> ServiceErrorBuilder
Start building a service-classified error.
kind is the stable code the service will switch on; message is the
caller-safe text. Defaults: no detail, retryable: false.
use dataflow_rs::DataflowError;
let e = DataflowError::service("circuit_open", "upstream unavailable")
.detail("connector 'billing' breaker open")
.retryable(true)
.build();
assert_eq!(e.kind(), Some("circuit_open"));
assert_eq!(e.detail(), Some("connector 'billing' breaker open"));
assert!(e.retryable());
// Display carries only the caller-safe text.
assert_eq!(e.to_string(), "upstream unavailable");Trait Implementations§
Source§impl Clone for DataflowError
impl Clone for DataflowError
Source§fn clone(&self) -> DataflowError
fn clone(&self) -> DataflowError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DataflowError
impl Debug for DataflowError
Source§impl<'de> Deserialize<'de> for DataflowError
impl<'de> Deserialize<'de> for DataflowError
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for DataflowError
impl Display for DataflowError
Source§impl Error for DataflowError
impl Error for DataflowError
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()