anyhow integration for gix-error#2383
Conversation
cbf6002 to
680cfc9
Compare
This is mainly useful for `gitoxide-core`, which may call plumbing.
680cfc9 to
750144a
Compare
… source-chain display.
750144a to
04dbc3f
Compare
There was a problem hiding this comment.
Pull request overview
This pull request adds anyhow integration to gix-error and implements error source chains for the Exn and Error types. The main enhancement is the addition of an auto-chain-error feature flag that automatically flattens error trees into chains, making them compatible with anyhow and other error-handling libraries.
Changes:
- Added new concrete error types (
Message,ParseError,ChainedError) in gix-error - Implemented
std::error::Error::source()chains forExnandErrortypes - Added
auto-chain-errorfeature toggle withtree-erroroverride, makingauto-chain-errorthe default - Refactored
message!()macro usage throughout the codebase to use format string capture syntax - Added anyhow conversion support via the
anyhowfeature flag
Reviewed changes
Copilot reviewed 24 out of 27 changed files in this pull request and generated 16 comments.
Show a summary per file
| File | Description |
|---|---|
| justfile | Added test execution for auto-chain-error feature |
| gix/src/revision/spec/parse/delegate/*.rs | Updated message! macro calls to use format string capture syntax |
| gix/Cargo.toml | Added auto-chain-error to default features, tree-error to dev features |
| gix-error/tests/error/*.rs | Updated tests to work with Message type and new error APIs |
| gix-error/tests/auto_chain_error.rs | New test file validating auto-chain-error behavior |
| gix-error/src/lib.rs | Added feature documentation, write_location helper, and concrete error module |
| gix-error/src/exn/impls.rs | Implemented anyhow conversion, ChainedError conversion, and renamed iter() to iter_frames() |
| gix-error/src/error.rs | Split implementation based on feature flags for tree vs chain error handling |
| gix-error/src/concrete/*.rs | New concrete error types (Message, ParseError, ChainedError) |
| gix-error/Cargo.toml | Added feature flags and dependencies for anyhow integration |
| gix-commitgraph/src/*.rs | Updated error message formatting to use capture syntax |
| gitoxide-core/src/*.rs | Removed manual error conversions now handled automatically |
| gitoxide-core/Cargo.toml | Added gix-error dependency with anyhow feature |
| Cargo.lock | Updated dependency graph |
04dbc3f to
fd8c038
Compare
|
The Given that no tests fail in the |
|
I don't think it is specific to 32bits, I hope it will resolve itself. In any case, I will see tomorrow 😅. |
fe68cc3 to
a435a29
Compare
|
Sounds good! It seemed weird enough that I figured I'd mention it. (Also, sorry about not saying what commit, fd8c038, those CI results were from--a new commit was pushed around the same time as I posted that comment.) But actually it wasn't as weird as I thought:
In any case, more pass since the subsequent commit a435a29. Edit: Those two tests still fail in |
…duce error chains suitable for `anyhow`.
This way, the behaviour of `gix::Error` is the same as it was before without actually exposing an `Exn` error tree.
a435a29 to
16327ef
Compare
|
Thanks Eliah Kagan (@EliahKagan). I have to confess that I did something quite messy: there is Maybe this knowledge should be put into the The origin of this issue is Maybe a better way to fix this is to change the |
Make it possible to follow
gix-errortypes withsource()chains, andprovide a conversion to anyhow (beyind a feature toggle).
Tasks
ExnExnErrorErrorsogixerrors will be compatible automatically