Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(293)

Unified Diff: grpc/prpc/client.go

Issue 2951393002: [errors] de-specialize Transient in favor of Tags. (Closed)
Patch Set: copyright Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: grpc/prpc/client.go
diff --git a/grpc/prpc/client.go b/grpc/prpc/client.go
index ff6b68bbad95d5465b463491d7841d5c18779d5b..da61581ef6ed6be77fd0bbd76d07e51be1f5d58a 100644
--- a/grpc/prpc/client.go
+++ b/grpc/prpc/client.go
@@ -203,7 +203,8 @@ func (c *Client) CallRaw(ctx context.Context, serviceName, methodName string, in
}
if err != nil {
// Treat all errors here as transient.
- return errors.WrapTransient(fmt.Errorf("failed to send request: %s", err))
+ return errors.Annotate(err).Reason("failed to send request").
+ Tag(retry.Tag).Err()
}
if options.resHeaderMetadata != nil {
@@ -266,7 +267,7 @@ func (c *Client) CallRaw(ctx context.Context, serviceName, methodName string, in
// AppEngine), and should be automatically retried even if a gRPC code
// header is not supplied.
if res.StatusCode >= http.StatusInternalServerError {
- err = errors.WrapTransient(err)
+ err = retry.Tag.Apply(err)
}
return err
}
@@ -279,12 +280,7 @@ func (c *Client) CallRaw(ctx context.Context, serviceName, methodName string, in
code := codes.Code(codeInt)
if code != codes.OK {
- desc := strings.TrimSuffix(buf.String(), "\n")
- err := grpcutil.Errf(code, "%s", desc)
- if grpcutil.IsTransientCode(code) {
- err = errors.WrapTransient(err)
- }
- return err
+ return grpcutil.Errf(code, "%s", strings.TrimSuffix(buf.String(), "\n"))
}
return nil
},
« grpc/grpcutil/errors.go ('K') | « grpc/grpcutil/errors.go ('k') | grpc/prpc/client_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698