Skip to main content

ErrorContext

Struct ErrorContext 

Source
pub struct ErrorContext { /* private fields */ }
Expand description

Where the engine mirrors failure records in the context, and how many it keeps.

After every recorded call that is not a Skip, each error record the call added (the handler’s own and the engine’s) is appended at the path as {"workflow_id", "task_id", "code", "status"}, status being the call’s (500 for an Err), and the array is trimmed to the newest limit. A call that adds no record writes nothing, so a message whose calls all succeed has no key at the path, not []. As in v3, every segment below the root names an object key: a non-array at the path, or anything but an object above it, is replaced.

At run start the engine removes the path’s key: a message never brings records in.

use dataflow_rs::run::{EngineConfig, ErrorContext};
use dataflow_rs::ErrorKind;

let ec = ErrorContext::new("metadata.errors".parse()?, ErrorContext::DEFAULT_LIMIT)?;
assert_eq!(ec.limit(), 32);
let config = EngineConfig::default().error_context(ec);
assert!(config.error_context.is_some());

// The engine owns `metadata.progress`, and every slot below it.
let refused = ErrorContext::new("metadata.progress.errors".parse()?, 32).unwrap_err();
assert_eq!(*refused.kind(), ErrorKind::Config);

Implementations§

Source§

impl ErrorContext

Source

pub const DEFAULT_LIMIT: usize = 32

The records kept when a host names no limit: v3’s default.

Source

pub fn new(path: Path, limit: usize) -> Result<Self>

The error context at path, keeping the newest limit records.

§Errors

ErrorKind::Config for a root (data, metadata or temp_data itself); for a path at or below a metadata slot the engine owns metadata.progress, which it writes after every call for cross-workflow chaining, and the run’s stamps metadata.processed_at, metadata.engine_version and metadata.channel; and for a limit of 0.

Source

pub fn path(&self) -> &Path

Where the records are mirrored.

Source

pub fn limit(&self) -> usize

How many records are kept: the newest.

Trait Implementations§

Source§

impl Clone for ErrorContext

Source§

fn clone(&self) -> Self

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 ErrorContext

Source§

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

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

impl Eq for ErrorContext

Source§

impl PartialEq for ErrorContext

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ErrorContext

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.