Convert more crates to gix-error#2373
Merged
Merged
Conversation
72 tasks
708ab60 to
98db506
Compare
98db506 to
cfbd465
Compare
cfbd465 to
9e9b97c
Compare
There was a problem hiding this comment.
Pull request overview
This PR migrates the gix-chunk crate from using thiserror to the new project-specific gix-error crate, with corresponding updates to downstream crates (gix-commitgraph and gix-pack) that consume the changed APIs. The migration introduces standardized error types (Message and ParseError) and adds supporting From trait implementations to enable ergonomic error conversions.
Changes:
- Replaces
thiserror-based error enums ingix-chunkwithgix-error::Messageandgix-error::ParseError - Adds
Fromtrait implementations ingix-errorto support conversion fromString,&'static str, and between error types - Updates downstream error handling in
gix-commitgraphandgix-packto use new error types - Enhances error messages with more context (e.g., chunk index in failure messages)
- Updates documentation in
gix-errorto describe standard error types and usage patterns
Reviewed changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| gix-error/src/lib.rs | Documents standard error types and usage patterns for the crate |
| gix-error/src/message.rs | Adds From implementations for String and &'static str; changes field visibility to pub(crate) |
| gix-error/src/parse.rs | Adds From implementations to enable conversions from Message, String, and &'static str |
| gix-chunk/Cargo.toml | Replaces thiserror dependency with gix-error |
| gix-chunk/src/file/decode.rs | Migrates error types from custom thiserror enums to ParseError; improves error messages |
| gix-chunk/src/file/index.rs | Replaces custom error modules with Message; removes offset_by_kind and data_by_kind error modules |
| gix-chunk/src/file/write.rs | Simplifies debug assertions by removing std::str::from_utf8 conversions |
| gix-commitgraph/Cargo.toml | Adds gix-error dependency |
| gix-commitgraph/src/file/init.rs | Updates error enum to use Message and ParseError instead of chunk-specific errors |
| gix-pack/Cargo.toml | Adds gix-error dependency |
| gix-pack/src/multi_index/init.rs | Updates error enum variants to use ChunkFileQuery and ChunkFileDecode with new error types |
| Cargo.lock | Updates dependencies to reflect gix-error additions and thiserror removal |
9e9b97c to
328e7c9
Compare
328e7c9 to
e6e90ff
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a PR to keep the results of a locally AI-assisted test to see how well it can port crates over.
In principle, it should be good at that, but it's all about the documentation to be able to guide it.
Let's take small steps, to ever larger and more complex crates.
Human intervention will be needed to decide which errors should be general and reusable, these then should also be
mostly hand-crafted and documented.
Tasks
gix-chunk