Skip to content

Convert more crates to gix-error#2373

Merged
Sebastian Thiel (Byron) merged 4 commits into
mainfrom
gix-error
Jan 13, 2026
Merged

Convert more crates to gix-error#2373
Sebastian Thiel (Byron) merged 4 commits into
mainfrom
gix-error

Conversation

@Byron

@Byron Sebastian Thiel (Byron) commented Jan 13, 2026

Copy link
Copy Markdown
Member

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

  • port gix-chunk

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 in gix-chunk with gix-error::Message and gix-error::ParseError
  • Adds From trait implementations in gix-error to support conversion from String, &'static str, and between error types
  • Updates downstream error handling in gix-commitgraph and gix-pack to use new error types
  • Enhances error messages with more context (e.g., chunk index in failure messages)
  • Updates documentation in gix-error to 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

Comment thread gix-chunk/src/file/index.rs Outdated
Comment thread gix-chunk/src/file/index.rs
Comment thread gix-error/src/lib.rs Outdated
Comment thread gix-commitgraph/src/file/init.rs Outdated
@Byron Sebastian Thiel (Byron) merged commit 4c6a7a7 into main Jan 13, 2026
30 checks passed
@Byron Sebastian Thiel (Byron) deleted the gix-error branch January 13, 2026 09:47
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.

2 participants