Open
Description
While with_error
already allows attaching errors, a color_eyre::Report
would need to be coerced into a StdError
, losing HelpInfo
sections, and probably also tracing
data in the process.
eyre-rs/color-eyre#125 would have implemented the option to attach proper color_eyre::Report
s, which would allow for something like this:
let mut errors = Vec::new();
for entry in walker {
if let Err(err) = do_stuff(entry) {
errors.push(err);
if params.fail_fast {
break;
}
}
}
if !errors.is_empty() {
let mut err = eyre::eyre!("Failed to do_stuff with {} errors", errors.len());
for e in errors {
err = err.report(e);
}
return Err(err);
}
This would render nicely, with the full details for all errors, including helpful sections like from wrap_err
or with_suggestion
.