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 · 5 comments · May be fixed by #208
Open

Feature request: Allow attaching Reports to Reports #198

sclu1034 opened this issue Aug 27, 2024 · 5 comments · May be fixed by #208
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
@afmireski
Copy link

Hello, is this issue still relevant? I'm a newbie, but I'd like to try helping.

@LeoniePhiline
Copy link
Contributor

@afmireski Contributions are welcome — feel free to claim this issue and start working on it! :)

@afmireski
Copy link

Thanks. I'll start soon.

@afmireski afmireski linked a pull request Nov 7, 2024 that will close this issue
3 tasks
@afmireski
Copy link

Hello, I've finished. I've opened a PR: #208.

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

Successfully merging a pull request may close this issue.

4 participants