Skip to main content

propagate_error

Function propagate_error 

Source
pub fn propagate_error<T>(
    error: Box<dyn Error>,
    module_id: &str,
    context: &Context<T>,
) -> ModuleError
Expand description

Wrap a raw error into a standardized ModuleError (Algorithm A11).

If the error is already a ModuleError, enriches it with trace context (trace_id, module_id, call_chain) where missing. Otherwise wraps it as a ModuleExecuteError.

§Arguments

  • error - The raw error to propagate.
  • module_id - Module ID where the error occurred.
  • context - Current execution context.

§Returns

A ModuleError with trace_id, module_id, and call_chain attached.