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

Adopt stacked error to snafu #471

Open
waynexia opened this issue Dec 20, 2024 · 1 comment
Open

Adopt stacked error to snafu #471

waynexia opened this issue Dec 20, 2024 · 1 comment

Comments

@waynexia
Copy link

Hi @shepmaster! I'm the author of that post on hackernews. I'm thrilled to see snafu and this mechanism being discussed so much.

Snafu has no doubt helped us a lot in organizing complex error variants and saved time on debugging. I'm wondering if we can contribute it to the upstream (here) and let people use and evolve it together. From my side, I have two concrete motivations for doing this, (1) implementing it out of snafu requires some hacking code and (2) pushing it to a more common location can further accomplish the error stack, the current stack will become chaos when getting through different error libs from different dependencies.

This might not be a trivial change. I'd like to hear some suggestions and/or feedback from your side on whether this is viable and if so how can we get started ❤️

@Enet4
Copy link
Collaborator

Enet4 commented Jan 2, 2025

Thank you for sharing your use case and experience in the use of Snafu!

I have been reading your blog post on & off between breaks in order to grasp what was developed on top of the library, and I'm probably still not quite there yet. It would be really helpful if you can explain it here in a few sentences.

From what I could gather (please correct me if I'm missing something in this rationale), the concept of stacked error is meant to be the StackedError trait with the corresponding procedure macro to implement it. The capabilities in this trait already exist in the library:

  • next and last are methods for traversal of the error source chain. The built-in alternative is ErrorCompat::iter_chain, the output is usually a ChainCompat which implements Iterator.
  • debug_fmt offers error reporting, which is already implemented in Report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants