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

Unified Diff: common/gcloud/googleoauth/info.go

Issue 2951393002: [errors] de-specialize Transient in favor of Tags. (Closed)
Patch Set: more refactor 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: common/gcloud/googleoauth/info.go
diff --git a/common/gcloud/googleoauth/info.go b/common/gcloud/googleoauth/info.go
index 91d4f2fbce568289f52c0b0e2b16588517a2e479..cc8440c674866739239e691bb89848a803de688c 100644
--- a/common/gcloud/googleoauth/info.go
+++ b/common/gcloud/googleoauth/info.go
@@ -11,6 +11,7 @@ import (
"github.com/luci/luci-go/common/errors"
"github.com/luci/luci-go/common/logging"
+ "github.com/luci/luci-go/common/retry/transient"
"google.golang.org/api/googleapi"
"golang.org/x/net/context"
@@ -79,7 +80,7 @@ func GetTokenInfo(c context.Context, params TokenInfoParams) (*TokenInfo, error)
resp, err := ctxhttp.Get(c, params.Client, params.Endpoint+"?"+v.Encode())
if err != nil {
logging.WithError(err).Errorf(c, "POST %s failed", params.Endpoint)
- return nil, errors.WrapTransient(err)
+ return nil, transient.Tag.Apply(err)
}
defer googleapi.CloseBody(resp)
if err := googleapi.CheckResponse(resp); err != nil {
@@ -87,7 +88,7 @@ func GetTokenInfo(c context.Context, params TokenInfoParams) (*TokenInfo, error)
if apiErr, ok := err.(*googleapi.Error); ok && apiErr.Code < 500 {
return nil, ErrBadToken
}
- return nil, errors.WrapTransient(err)
+ return nil, transient.Tag.Apply(err)
}
info := &TokenInfo{}
@@ -95,7 +96,7 @@ func GetTokenInfo(c context.Context, params TokenInfoParams) (*TokenInfo, error)
// This should never happen. If it does, the token endpoint has gone mad,
// and maybe it will recover soon. So mark the error as transient.
logging.WithError(err).Errorf(c, "Bad token info endpoint response")
- return nil, errors.WrapTransient(err)
+ return nil, transient.Tag.Apply(err)
}
return info, nil

Powered by Google App Engine
This is Rietveld 408576698