Skip to main content

DataflowError

Enum DataflowError 

Source
#[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
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Validation(String)

Validation errors occurring during rule evaluation

§

FunctionExecution

Errors during function execution

Fields

§context: String
§

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

Fields

§status: u16
§message: String
§

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.

Fields

§kind: String

Stable, service-owned classification, e.g. "circuit_open".

§message: String

Caller-safe text.

§detail: Option<String>

Operator-only text: logged and kept on the trace, not intended for an untrusted caller.

§retryable: bool

Retryability, declared by the service rather than inferred from the variant.

Implementations§

Source§

impl DataflowError

Source

pub fn function_execution<S: Into<String>>( context: S, source: Option<DataflowError>, ) -> Self

Creates a new function execution error with context

Source

pub fn http<S: Into<String>>(status: u16, message: S) -> Self

Creates a new HTTP error

Source

pub fn from_io(err: Error) -> Self

Convert from std::io::Error

Source

pub fn from_serde(err: Error) -> Self

Convert from serde_json::Error

Source

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.

Source

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.

Source

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.

Source

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

Source§

fn clone(&self) -> DataflowError

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DataflowError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for DataflowError

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for DataflowError

Source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for DataflowError

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl Serialize for DataflowError

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.