Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Allow attaching Reports to Reports #198

Open
sclu1034 opened this issue Aug 27, 2024 · 1 comment
Open

Feature request: Allow attaching Reports to Reports #198

sclu1034 opened this issue Aug 27, 2024 · 1 comment
Labels
A-color-eyre Area: color-eyre subcrate C-enhancement Category: New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@sclu1034
Copy link

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.

@yaahc
Copy link
Collaborator

yaahc commented Aug 29, 2024

no objections

@yaahc yaahc added C-enhancement Category: New feature or request help wanted Extra attention is needed good first issue Good for newcomers A-color-eyre Area: color-eyre subcrate labels Aug 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-color-eyre Area: color-eyre subcrate C-enhancement Category: New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants