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

Comparison to anyhow #460

Open
dhouck opened this issue Jul 15, 2024 · 2 comments
Open

Comparison to anyhow #460

dhouck opened this issue Jul 15, 2024 · 2 comments

Comments

@dhouck
Copy link

dhouck commented Jul 15, 2024

Like with #321, the Comparison page seems incomplete without a comparison between SNAFU and Anyhow. As far as I can tell the Whatever type in SNAFU is very similar to an Anyhow error, but I donʼt know enough about the details of either one to write a good comparison myself.

@Enet4
Copy link
Collaborator

Enet4 commented Jul 21, 2024

I wrote a piece about migrating a software project to SNAFU some years ago. Some of the parts are outdated, but the concept of anyhow relying on a dynamic error type still holds.

anyhow and eyre are mostly designed for applications, as they facilitate the aggregation of multiple error types into a single source of information about the error. This error can be expanded across the program stack via the extended context operator, hence gaining additional information. They deliberately employ a "kitchen-sink" error type, which is more complicated to take part in code flow if necessary. When it comes to libraries, structured error types are usually preferred.

@dhouck
Copy link
Author

dhouck commented Jul 22, 2024

I definitely prefer structure types in a lot of cases, but since snafu has Whatever also, it seems worth doing direct comparisons with that.

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