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

Unified Diff: tokenserver/appengine/impl/utils/policy/entities.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/utils/policy/entities.go
diff --git a/tokenserver/appengine/impl/utils/policy/entities.go b/tokenserver/appengine/impl/utils/policy/entities.go
index 7e9a9ae0dd625cdd4038c6c15b88749a5de1ef8a..567bcdc9d1bb87e938937567d876cbe2f646db75 100644
--- a/tokenserver/appengine/impl/utils/policy/entities.go
+++ b/tokenserver/appengine/impl/utils/policy/entities.go
@@ -8,7 +8,7 @@ import (
"golang.org/x/net/context"
"github.com/luci/gae/service/datastore"
- "github.com/luci/luci-go/common/errors"
+ "github.com/luci/luci-go/common/retry/transient"
)
// importedPolicyHeader is an entity that holds metadata about a cached policy.
@@ -55,7 +55,7 @@ func updateImportedPolicy(c context.Context, name, rev, sha256 string, serialize
SHA256: sha256,
Data: serialized,
}
- return errors.WrapTransient(datastore.RunInTransaction(c, func(c context.Context) error {
+ return transient.Tag.Apply(datastore.RunInTransaction(c, func(c context.Context) error {
return datastore.Put(c, header, body)
}, nil))
}
@@ -69,7 +69,7 @@ func getImportedPolicyHeader(c context.Context, name string) (*importedPolicyHea
case err == datastore.ErrNoSuchEntity:
return nil, nil
case err != nil:
- return nil, errors.WrapTransient(err)
+ return nil, transient.Tag.Apply(err)
}
return e, nil
}
@@ -85,7 +85,7 @@ func getImportedPolicyBody(c context.Context, name string) (*importedPolicyBody,
case err == datastore.ErrNoSuchEntity:
return nil, nil
case err != nil:
- return nil, errors.WrapTransient(err)
+ return nil, transient.Tag.Apply(err)
}
return e, nil
}

Powered by Google App Engine
This is Rietveld 408576698