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

Unified Diff: server/auth/auth.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: server/auth/auth.go
diff --git a/server/auth/auth.go b/server/auth/auth.go
index e42e06462cd91bdb451fc9ac8035b363ac201215..ac19c3aa1d71137f0e50b09e531f9c4779e5185c 100644
--- a/server/auth/auth.go
+++ b/server/auth/auth.go
@@ -12,6 +12,7 @@ import (
"github.com/luci/luci-go/common/errors"
"github.com/luci/luci-go/common/logging"
+ "github.com/luci/luci-go/common/retry/transient"
"github.com/luci/luci-go/server/auth/delegation"
"github.com/luci/luci-go/server/auth/identity"
@@ -117,7 +118,7 @@ func (a *Authenticator) GetMiddleware() router.Middleware {
return func(c *router.Context, next router.Handler) {
ctx, err := a.Authenticate(c.Context, c.Request)
switch {
- case errors.IsTransient(err):
+ case transient.Tag.In(err):
replyError(c.Context, c.Writer, 500, "Transient error during authentication", err)
case err != nil:
replyError(c.Context, c.Writer, 401, "Authentication error", err)
@@ -244,7 +245,7 @@ func (a *Authenticator) Authenticate(c context.Context, r *http.Request) (contex
OwnServiceIdentity: ownServiceIdentity,
})
if err != nil {
- if errors.IsTransient(err) {
+ if transient.Tag.In(err) {
report(err, "ERROR_TRANSIENT_IN_TOKEN_CHECK")
} else {
report(err, "ERROR_BAD_DELEGATION_TOKEN")
« grpc/grpcutil/errors.go ('K') | « server/auth/actor.go ('k') | server/auth/auth_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698