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

Unified Diff: common/auth/localauth/server.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/localauth/server.go
diff --git a/common/auth/localauth/server.go b/common/auth/localauth/server.go
index 49df2dc78075e1008eb1380fd77da79b9d1ccc9e..b0f58d7dddef69489b5cc152e2ce170da139a385 100644
--- a/common/auth/localauth/server.go
+++ b/common/auth/localauth/server.go
@@ -23,8 +23,8 @@ import (
"github.com/luci/luci-go/common/auth/localauth/rpcs"
"github.com/luci/luci-go/common/data/rand/cryptorand"
"github.com/luci/luci-go/common/data/stringset"
- "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/common/runtime/paniccatcher"
"github.com/luci/luci-go/lucictx"
)
@@ -42,9 +42,9 @@ import (
// duration (which is typically on order of minutes), but it may live longer.
// Clients may cache the returned token for the duration of its lifetime.
//
-// May return transient errors (in errors.IsTransient returning true sense).
-// Such errors result in HTTP 500 responses. This is appropriate for non-fatal
-// errors. Clients may immediately retry requests on such errors.
+// May return transient errors (in transient.Tag.In(err) returning true
+// sense). Such errors result in HTTP 500 responses. This is appropriate for
+// non-fatal errors. Clients may immediately retry requests on such errors.
//
// Any non-transient error is considered fatal and results in an RPC-level
// error response ({"error": ...}). Clients must treat such responses as fatal
@@ -335,7 +335,7 @@ func (h *protocolHandler) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
}
// Transient errors are returned as HTTP 500 responses.
- if errors.IsTransient(err) {
+ if transient.Tag.In(err) {
http.Error(rw, fmt.Sprintf("Transient error - %s", err), http.StatusInternalServerError)
return
}

Powered by Google App Engine
This is Rietveld 408576698