Skip to content

refactor!: replace anyhow with thiserror#4925

Merged
clason merged 5 commits intotree-sitter:masterfrom
WillLillis:loader_errors
Nov 14, 2025
Merged

refactor!: replace anyhow with thiserror#4925
clason merged 5 commits intotree-sitter:masterfrom
WillLillis:loader_errors

Conversation

@WillLillis
Copy link
Member

@WillLillis WillLillis commented Oct 4, 2025

This removes all usage of the anyhow crate from the project outside of the cli and xtask crates. In particular, the loader and config crates now return errors in the form of structured data via thiserror.

I'm opening this as a draft for now, as this shouldn't block the 0.26.1 release. This has a large set of user-facing changes (error messages are important!), so regardless of the release this shouldn't be rushed in without a thorough check over.

I also slightly reworked the usage of thiserror in the generate crate to include the relevant path (if available) when an IO error occurs. This is more verbose at call sites, but should be very helpful in both debugging and giving more context to end users.

@clason
Copy link
Contributor

clason commented Oct 31, 2025

needs (another) local cargo --update?

@clason clason mentioned this pull request Oct 31, 2025
9 tasks
@clason clason modified the milestone: 0.26 Oct 31, 2025
@WillLillis
Copy link
Member Author

needs (another) local cargo --update?

Oops, messed up the rebase. Thanks for the fixup!

@WillLillis WillLillis marked this pull request as ready for review November 12, 2025 06:33
@WillLillis
Copy link
Member Author

It's been long enough, I think as long as we can give this PR its due diligence this should be fine to include in 0.26.1.

@clason clason added this to the 0.26 milestone Nov 12, 2025
@clason clason merged commit 0df2916 into tree-sitter:master Nov 14, 2025
19 checks passed
@clason
Copy link
Contributor

clason commented Nov 14, 2025

Let's give this a whirl then!

@WillLillis WillLillis deleted the loader_errors branch December 2, 2025 02:45
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

Successfully merging this pull request may close these issues.

Include file path on OS error

2 participants