-
-
Notifications
You must be signed in to change notification settings - Fork 414
gix-error punch-through
#2352
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
gix-error punch-through
#2352
Conversation
759c85c to
238924c
Compare
This will make for easier introspection for users of these errors.
…f4f260121f9f84305 This is the basis for substantial changes to make it usable for the `gix-*` crates. The wonderful aspect about this is not only a great reduction in dependencies, but it also removes most proc-macro invocations.
59b14fa to
8c54df4
Compare
- Top-level `Error` - dissolve `Exn` back to `Box<E>` - Use `dyn Error + Send + Sync + 'static'`
|
@copilot Remove |
|
@copilot Remove |
Co-authored-by: Byron <[email protected]>
547c8df to
f5bd9dd
Compare
|
@copilot Add |
610014f to
1ce7847
Compare
There was a problem hiding this comment.
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 introduces a new error handling system for gitoxide by adding the gix-error crate. The goal is to provide better error context tracking with call-site information and support for error trees (multiple error causes), moving away from thiserror-based errors to a custom solution inspired by exn.
Changes:
- Adds new
gix-errorcrate withError,Exn<E>,Message, andParseErrortypes - Migrates
gix-dateto usegix_error::ParseErrorinstead of custom error enum - Updates
gix-revisionto returnResult<(), Exn>from delegate methods instead ofOption<()> - Updates
gixcrate's revision parsing to handle new error types and update test snapshots - Updates
gix-refspec,gix-actor, andgitoxide-corefor compatibility
Reviewed changes
Copilot reviewed 70 out of 71 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| gix-error/* | New crate providing error handling primitives with call-site tracking |
| gix-date/* | Migrated to use gix_error::ParseError |
| gix-revision/* | Updated delegate traits to return Result<(), Exn> instead of Option<()> |
| gix/src/revision/spec/parse/* | Extensive refactoring to use new error types |
| gix/tests/* | Updated test snapshots for new error messages |
| gix-refspec/* | Updated to handle boxed ParseError |
| Cargo.toml, Cargo.lock | Added gix-error to workspace |
|
The failure here, in the (This appeared after auto-merge was enabled, and blocks it, suggesting it may be unexpected.) |
- Add a `Message` error to `gix-error` for general use.
|
@Byron Also, is the recent switch from merging with a merge commit to using "rebase and merge" intentional? That's what auto-merge is curently set to do here, and it looks like it's been used in a couple other places, yet very rarely until recently. I ask because:
|
|
OMG! Finally! It took me ours to find a silly bug which would make downcasting fail, a critical feature to be able to inspect the error tree. Now that it's proven to be working via The punch went through!
I only intended to use it for Copilot sub-PRs, which I tried to use more here. The idea was to keep it separate, but bring it in as flat commit list so I could still rebase the parent PR when needed.
This is exactly what happened 😅. So there is no change overall, just me failing to change the setting back. Good it didn't merge :D. |
|
With that said, I really like It still needs anyhow integration to make the error sequential and turn it into a proper But I digress, I haven't been this excited in a while. |
|
|
||
| /// Raise this error as a new exception, with `sources` as causes. | ||
| #[track_caller] | ||
| fn raise_iter<T, I>(self, sources: I) -> Exn<Self> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI we use raise_all for this feature which also renames Exn::from_iter - fast/exn#33
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for letting me know! I love the new name, would you mind contributing the rename to the codebase of gitoxide? I'd love to see your name in the commit list.
Besides, any PR that keeps both versions in sync is welcome, and maybe it's also a good 'trial' for you. In the end, I just do what I must to truly make it work for gitoxide and its consumers, which probably is a good indicator for other potential adopters as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. Let me try to prepare one.
Out of the thread: I'm considering using gix to wrap a Git CLI to better apply my workflow with agentic coding tools. It looks like ein here and jujutsu all do something helpful. I'll let you know if I make any concrete progress, though it's still a very rough idea now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, ein is just a prototype that probably isn't going anywhere soon, but jj is by all means mature enough to use. I don't know how well it can be understood by agents though. Building a custom tool with gix is possible, but many 'standard' things still require expert level of knowledge. git2 is definitely easier to use and kind of has everything.
Tasks
exnforgix-dateFramecan only cast to specific types, not to anything that one of them implements.error_generic_member_accessrust-lang/rust#99301 soon being merged, I think it's not problem to one day provide information through that mechanism.IsSpurioushandles today.exnfor compatibilityError->ErrorExtErroris top-level type-erased errorgix-revisioncargo run --bin gix -- diff file CODE_OF_CONDUCT.md CHANGELOG.mdwork usingError::iter_frames()Follow-up
exnforgix-transport