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

Unified Diff: server/auth/internal/fetch.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/internal/fetch.go
diff --git a/server/auth/internal/fetch.go b/server/auth/internal/fetch.go
index cb3512c9effbde805d735e779680b7666c9c2866..f1f2c8db89627c00b77e2537cf3b287eec3bef43 100644
--- a/server/auth/internal/fetch.go
+++ b/server/auth/internal/fetch.go
@@ -11,8 +11,8 @@ import (
"io/ioutil"
"net/http"
- "github.com/luci/luci-go/common/errors"
"github.com/luci/luci-go/common/logging"
+ "github.com/luci/luci-go/common/retry/transient"
"golang.org/x/net/context"
"golang.org/x/net/context/ctxhttp"
@@ -118,7 +118,7 @@ func fetchJSON(c context.Context, client *http.Client, val interface{}, f func()
resp, err := ctxhttp.Do(c, client, r)
if err != nil {
logging.Errorf(c, "auth: URL fetch failed, can't connect - %s", err)
- return errors.WrapTransient(err)
+ return transient.Tag.Apply(err)
}
defer func() {
ioutil.ReadAll(resp.Body)
@@ -133,7 +133,7 @@ func fetchJSON(c context.Context, client *http.Client, val interface{}, f func()
logging.Errorf(c, "auth: URL fetch failed - HTTP %d - %s", resp.StatusCode, string(body))
err := fmt.Errorf("auth: HTTP code (%d) when fetching %s", resp.StatusCode, r.URL)
if resp.StatusCode >= 500 {
- return errors.WrapTransient(err)
+ return transient.Tag.Apply(err)
}
return err
}

Powered by Google App Engine
This is Rietveld 408576698