Skip to main content

TraceableError

Trait TraceableError 

Source
pub trait TraceableError: Debug + Display {
    // Required methods
    fn layer_code(&self) -> String;
    fn chain_codes(&self) -> Vec<String>;

    // Provided method
    fn diagnostic_code(&self) -> String { ... }
}
Expand description

Defines an error that can be deterministically traced through a distributed architecture.

Implementations of this trait (typically derived automatically via #[derive(TraceableError)] on enums) are capable of recursively interrogating their underlying causal chain and reporting a unified chronological history of layer codes.

Each layer code is represented by a structured String identifier: format!("{crate_name}::{enum_name}::{variant_name}").

This structured layout facilitates highly readable failure trajectory reconstruction across distributed IPC boundaries and dynamic crate boundaries.

Required Methods§

Source

fn layer_code(&self) -> String

Returns this specific layer’s string identifier (format: CrateName::EnumName::EnumValue).

Source

fn chain_codes(&self) -> Vec<String>

Recursively interrogates underlying error sources to build the chronological array of layer codes.

The resulting vector is ordered from outermost (most recent) layer to innermost (root cause).

Provided Methods§

Source

fn diagnostic_code(&self) -> String

Formats the layer code vector into a standardized diagnostic string (e.g., "Crate1::Enum1::Val1-Crate2::Enum2::Val2").

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl TraceableError for Error

Implementors§