pub fn err_with(
message: &'static str,
attrs: impl Fn(&mut HashMap<&'static str, String>)
) -> ErrorExpand description
Create a new error and attach attributes. If you want to inherit attributes
from a logging context, see Log::new_err.
Examples found in repository?
examples/fatal.rs (line 14)
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
fn main() {
fatal(
agg_err(
"The main thing failed",
vec![
err_with("The primary system exploded", ea!(att1 = "Hi", att2 = 423))
.also(
err_with(
"An incidental_error with a threateningly long message that might be able to wrap if I extend the length somewhat further and then some I guess going by editor width this might not be quite enough",
ea!(
another_attr =
"This is a very long message, hopefully it gets wrapped somewhere between the start and the end of the screen"
),
),
)
.also(err("Nothing much else to add")),
err("Just tacking this one on too")
],
),
);
}