pub struct ErrorEvent {
pub when: DateTime<Utc>,
pub scope: ErrorScope,
pub error: WeaveError,
pub tags: Vec<String>,
pub context: Value,
}Expand description
A workflow error event capturing scope, error payload, tags, and context.
Serializes to JSON with a tagged-union scope field:
{
"when": "2025-11-02T10:30:00Z",
"scope": { "scope": "node", "kind": "Parser", "step": 1 },
"error": {
"message": "Failed to parse input",
"cause": { "message": "Invalid JSON syntax", "details": {"line": 3} }
},
"tags": ["validation"],
"context": {"file": "/tmp/input.json"}
}Scope variants: "node" (kind, step), "scheduler" (step),
"runner" (session, step), "app".
See docs/schemas/error_event.json for the full JSON Schema.
§Example
use weavegraph::channels::errors::{ErrorEvent, WeaveError};
use serde_json::json;
let event = ErrorEvent::node("Parser", 1, WeaveError::msg("Parse error"))
.with_tag("validation")
.with_context(json!({"line": 42}));
let json_str = serde_json::to_string(&event).unwrap();Fields§
§when: DateTime<Utc>Timestamp at which the error occurred.
scope: ErrorScopeWhere in the workflow the error originated.
error: WeaveErrorStructured error payload.
String tags for filtering and categorization.
context: ValueOptional structured context metadata.
Implementations§
Source§impl ErrorEvent
impl ErrorEvent
Sourcepub fn node<S: Into<String>>(kind: S, step: u64, error: WeaveError) -> Self
pub fn node<S: Into<String>>(kind: S, step: u64, error: WeaveError) -> Self
Creates a node-scoped error event.
Sourcepub fn scheduler(step: u64, error: WeaveError) -> Self
pub fn scheduler(step: u64, error: WeaveError) -> Self
Creates a scheduler-scoped error event.
Sourcepub fn runner<S: Into<String>>(session: S, step: u64, error: WeaveError) -> Self
pub fn runner<S: Into<String>>(session: S, step: u64, error: WeaveError) -> Self
Creates a runner-scoped error event.
Sourcepub fn app(error: WeaveError) -> Self
pub fn app(error: WeaveError) -> Self
Creates an app-scoped error event.
Replaces the tag list.
Sourcepub fn with_context(self, context: Value) -> Self
pub fn with_context(self, context: Value) -> Self
Attaches context metadata.
Trait Implementations§
Source§impl Clone for ErrorEvent
impl Clone for ErrorEvent
Source§fn clone(&self) -> ErrorEvent
fn clone(&self) -> ErrorEvent
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ErrorEvent
impl Debug for ErrorEvent
Source§impl Default for ErrorEvent
impl Default for ErrorEvent
Source§fn default() -> ErrorEvent
fn default() -> ErrorEvent
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for ErrorEvent
impl<'de> Deserialize<'de> for ErrorEvent
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for ErrorEvent
impl PartialEq for ErrorEvent
Source§fn eq(&self, other: &ErrorEvent) -> bool
fn eq(&self, other: &ErrorEvent) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for ErrorEvent
impl Serialize for ErrorEvent
impl Eq for ErrorEvent
impl StructuralPartialEq for ErrorEvent
Auto Trait Implementations§
impl Freeze for ErrorEvent
impl RefUnwindSafe for ErrorEvent
impl Send for ErrorEvent
impl Sync for ErrorEvent
impl Unpin for ErrorEvent
impl UnsafeUnpin for ErrorEvent
impl UnwindSafe for ErrorEvent
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.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> 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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> JsonSerializable<PersistenceError> for Twhere
T: Serialize + for<'de> DeserializeOwned,
impl<T> JsonSerializable<PersistenceError> for Twhere
T: Serialize + for<'de> DeserializeOwned,
Source§fn to_json_string(&self) -> Result<String, PersistenceError>
fn to_json_string(&self) -> Result<String, PersistenceError>
Serialize to a JSON string.
Source§fn from_json_str(s: &str) -> Result<T, PersistenceError>
fn from_json_str(s: &str) -> Result<T, PersistenceError>
Deserialize from a JSON string.