Index: tokenserver/client/tokenclient.go |
diff --git a/tokenserver/client/tokenclient.go b/tokenserver/client/tokenclient.go |
index 50a058cb315938fc944af4ec5e51defc6bd681b1..0c7139e93a0eaed46c60f1645bba7711461415a1 100644 |
--- a/tokenserver/client/tokenclient.go |
+++ b/tokenserver/client/tokenclient.go |
@@ -14,8 +14,8 @@ import ( |
"google.golang.org/grpc/codes" |
"github.com/luci/luci-go/common/clock" |
- "github.com/luci/luci-go/common/errors" |
"github.com/luci/luci-go/common/proto/google" |
+ "github.com/luci/luci-go/common/retry/transient" |
"github.com/luci/luci-go/grpc/grpcutil" |
"github.com/luci/luci-go/tokenserver/api/minter/v1" |
@@ -56,13 +56,6 @@ type RPCError struct { |
ServiceVersion string // version of the backend, if known |
} |
-// IsTransient is needed to implement errors.Transient. |
-func (e RPCError) IsTransient() bool { |
- return e.error != nil && grpcutil.IsTransientCode(e.GrpcCode) |
-} |
- |
-var _ errors.Transient = RPCError{} |
- |
// MintMachineToken signs the request using the signer and sends it. |
// |
// It will update in-place the following fields of the request: |
@@ -116,10 +109,15 @@ func (c *Client) MintMachineToken(ctx context.Context, req *minter.MachineTokenR |
// Fatal pRPC-level error or transient error in case retries didn't help. |
if err != nil { |
- return nil, RPCError{ |
+ code := grpc.Code(err) |
+ err = RPCError{ |
error: err, |
- GrpcCode: grpc.Code(err), |
+ GrpcCode: code, |
+ } |
+ if grpcutil.IsTransientCode(code) { |
+ err = transient.Tag.Apply(err) |
} |
+ return nil, err |
} |
// The response still may indicate a fatal error. |