-
Notifications
You must be signed in to change notification settings - Fork 5
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
Add support for grpc error details and multiple errors #7
Conversation
2fd184b
to
b5a9ec0
Compare
Updated and now handles a case where multi-errors get wrapped |
Marking this back to draft, #9 should be considered first. We should also consider in the multi-error case using the collapsible errors introduced in the stacks PR. |
57fa4b4
to
5596f37
Compare
Updated, this is ready to review again. Included better support for custom error types in the details similar to https://github.com/moby/buildkit/blob/master/util/grpcerrors/grpcerrors.go |
The Is interface may be used to resolve if no other unwrap interface is implemented. This interface is safe to use in this situation, unlike errors.Is, since the error should not be unwrapped further. Signed-off-by: Derek McGowan <derek@mcg.dev>
5596f37
to
13de52f
Compare
Updated for better resolution of primary error cause and handling of error details. |
@stevvooe LGTY? |
errgrpc/grpc.go
Outdated
if isGRPC { | ||
desc = s.Message() | ||
code = s.Code() | ||
|
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.
nit: extra empty line
When multiple errors are given, use details to encode errors into the grpc status and decode details back into errors. Signed-off-by: Derek McGowan <derek@mcg.dev>
13de52f
to
b9dce4d
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.
LGTM!
When multiple errors are given, use details to encode errors into the grpc status and decode details back into errors.
This allows supporting multiple errdefs as well as any error type which can be marshaled with proto or registered with typeurl.