Skip to content

grpcerrors: Ensure errors from errors.Join are preserved - #6226

Merged
tonistiigi merged 2 commits into
moby:masterfrom
cpuguy83:fix_grpcerrors_unwrap
Sep 17, 2025
Merged

tonistiigi merged 2 commits into
moby:masterfrom
cpuguy83:fix_grpcerrors_unwrap

Conversation

@cpuguy83

Copy link
Copy Markdown
Member

Adds support for the Unwrap() []error interface used by errors.Join so that roundtripping through grpcerrors preserves types.

Fixes #6225

Adds support for the `Unwrap() []error` interface used by `errors.Join`
so that roundtripping through grpcerrors preserves types.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
@cpuguy83
cpuguy83 force-pushed the fix_grpcerrors_unwrap branch from 0ac75eb to c3873a9 Compare September 16, 2025 17:06

@tonistiigi tonistiigi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If you look at Code and AsGRPCStatus then they also seem to just detect Unwrap() error directly.

@cpuguy83

Copy link
Copy Markdown
Member Author

Those are a little tricky since multiple errors could have a status/code.
I've made it so it returns the first one that returns something valid in the stack.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
@cpuguy83
cpuguy83 force-pushed the fix_grpcerrors_unwrap branch from 7bc0e08 to d400e9f Compare September 16, 2025 19:35
@tonistiigi
tonistiigi merged commit 0e92dbb into moby:master Sep 17, 2025
139 checks passed
@cpuguy83
cpuguy83 deleted the fix_grpcerrors_unwrap branch September 17, 2025 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Typed errors possibly getting lost when errors.Join is used

2 participants