pub fn accumulate_context<E, I, C>(error: E, contexts: I) -> ComposableError<E>where
I: IntoIterator<Item = C>,
C: IntoErrorContext,Expand description
Wraps an error with multiple context entries at once.
Creates a ComposableError and attaches all provided contexts.
§Arguments
error- The core error to wrapcontexts- Iterator of contexts to attach
§Examples
use error_rail::{accumulate_context, ErrorContext};
let contexts = vec![
ErrorContext::tag("db"),
ErrorContext::new("connection failed"),
];
let err = accumulate_context("timeout", contexts);
assert_eq!(err.context().len(), 2);