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

Unified Diff: tokenserver/appengine/impl/delegation/rpc_mint_delegation_token.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: tokenserver/appengine/impl/delegation/rpc_mint_delegation_token.go
diff --git a/tokenserver/appengine/impl/delegation/rpc_mint_delegation_token.go b/tokenserver/appengine/impl/delegation/rpc_mint_delegation_token.go
index 359d0d85dfc42912fc38ae012db452acdd6a6ee3..7294068ad93e2e5a264c6846ec7a5c3ed16e688a 100644
--- a/tokenserver/appengine/impl/delegation/rpc_mint_delegation_token.go
+++ b/tokenserver/appengine/impl/delegation/rpc_mint_delegation_token.go
@@ -16,8 +16,8 @@ import (
"github.com/luci/gae/service/info"
"github.com/luci/luci-go/common/clock"
- "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"
"github.com/luci/luci-go/server/auth/authdb"
"github.com/luci/luci-go/server/auth/delegation/messages"
@@ -125,7 +125,7 @@ func (r *MintDelegationTokenRPC) MintDelegationToken(c context.Context, req *min
// to resolve "https://<service-url>" entries to "service:<id>" entries.
query, err := buildRulesQuery(c, req, callerID)
if err != nil {
- if errors.IsTransient(err) {
+ if transient.Tag.In(err) {
logging.WithError(err).Errorf(c, "buildRulesQuery failed")
return nil, grpc.Errorf(codes.Internal, "failure when resolving target service ID - %s", err)
}
@@ -136,7 +136,7 @@ func (r *MintDelegationTokenRPC) MintDelegationToken(c context.Context, req *min
// Consult the config to find the rule that allows this operation (if any).
rule, err := rules.FindMatchingRule(c, query)
if err != nil {
- if errors.IsTransient(err) {
+ if transient.Tag.In(err) {
logging.WithError(err).Errorf(c, "FindMatchingRule failed")
return nil, grpc.Errorf(codes.Internal, "failure when checking rules - %s", err)
}
@@ -349,7 +349,7 @@ func resolveServiceIDs(c context.Context, urls []string, out *identityset.Set) e
for i := 0; i < len(urls); i++ {
result := <-ch
if result.Err != nil {
- if errors.IsTransient(result.Err) {
+ if transient.Tag.In(result.Err) {
return result.Err
}
return fmt.Errorf("could not resolve %q to service ID - %s", result.URL, result.Err)

Powered by Google App Engine
This is Rietveld 408576698