Skip to content

Feature request: Allow attaching Reports to Reports #198

Open
@sclu1034

Description

@sclu1034

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::Reports, 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions