-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
cloud,grpcutil: avoid pretty-printing nil gRPC status #103856
Conversation
a497904
to
16d82a1
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.
Reviewed 6 of 6 files at r1, all commit messages.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @dt and @stevendanna)
pkg/util/grpcutil/grpc_err_redaction.go
line 26 at r1 (raw file):
// return true, but the retuned error will have no message and // a code of OK. if se := (interface{ GRPCStatus() *grpcStatus.Status })(nil); errors.As(err, &se) {
Since the errors library is going to call grpcSpecialCasePrintFn
on every level of the error chain, don't use errors.As
here, which also recurses.
You can use the same simple cast as is performed inside status.FromError
already.
16d82a1
to
cffa3f8
Compare
In some cases, errors from the GCP library would be printed as grpc: [code 0/OK] This was the result of a few interacting features and changes: - The GCP library added an Unwrap() method to the error type they returned. - Our errors library has code to manually unwrap errors. - The underlying GCP error attempts to abstract over gRPC and HTTP errors. It implements a GRPCStatus() method that returns nil if the underlying issue was an HTTP issue. - Our custom error printer in grpcutil would specially print anything that implements GRPCStatus(), regardless of the return value. Here, I've updated the custom printer to ignore cases where GRPCStatus() returns nil. Epic: none Release note (bug fix): Fix a bug in which some GCP-related errors would be returned with an uninformative error.
cffa3f8
to
5b4aa44
Compare
bors r=knz |
Build failed: |
bors retry |
Build succeeded: |
Thank you! |
In some cases, errors from the GCP library would be printed as
This was the result of a few interacting features and changes:
The GCP library added an Unwrap() method to the error type they returned.
Our errors library has code to manually unwrap errors.
The underlying GCP error attempts to abstract over gRPC and HTTP errors. It implements a GRPCStatus() method that returns nil if the underlying issue was an HTTP issue.
Our custom error printer in grpcutil would specially print anything that implements GRPCStatus(), regardless of the return value.
Here, I've updated the custom printer to ignore cases where GRPCStatus() returns nil.
Epic: CRDB-27642
Release note (bug fix): Fix a bug in which some GCP-related errors would be returned with an uninformative error.