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

Unified Diff: common/auth/internal/disk_cache.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/auth/internal/disk_cache.go
diff --git a/common/auth/internal/disk_cache.go b/common/auth/internal/disk_cache.go
index 27a5ce53e2a8015c3c9a750f495a316a0d52910b..95433e64d56f93a09c5e57d8c5066fd350880aec 100644
--- a/common/auth/internal/disk_cache.go
+++ b/common/auth/internal/disk_cache.go
@@ -15,9 +15,9 @@ import (
"golang.org/x/oauth2"
"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"
+ "github.com/luci/luci-go/common/retry/transient"
)
const (
@@ -198,7 +198,7 @@ func (c *DiskTokenCache) writeCacheFile(cache *cacheFile, now time.Time) error {
// a retry in updateCacheFile.
if err = os.Rename(tmp.Name(), c.absPath()); err != nil {
cleanup()
- return errors.WrapTransient(err)
+ return transient.Tag.Apply(err)
}
return nil
}
@@ -222,7 +222,7 @@ func (c *DiskTokenCache) updateCacheFile(cb func(*cacheFile, time.Time) bool) er
Multiplier: 1.5,
}
}
- return retry.Retry(c.Context, retry.TransientOnly(retryParams), func() error {
+ return retry.Retry(c.Context, transient.Only(retryParams), func() error {
cache, err := c.readCacheFile()
if err != nil {
return err

Powered by Google App Engine
This is Rietveld 408576698