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/settings/admin/handlers.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/settings/admin/handlers.go
diff --git a/server/settings/admin/handlers.go b/server/settings/admin/handlers.go
index e5cb48bb9085ff2d415e19b8a2f493cf99be768d..b7d78af432ff2bf0d2dcb3a2c72427b4a3283c60 100644
--- a/server/settings/admin/handlers.go
+++ b/server/settings/admin/handlers.go
@@ -14,6 +14,7 @@ import (
"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"
@@ -74,7 +75,7 @@ func InstallHandlers(r *router.Router, base router.MiddlewareChain, adminAuth au
// replyError sends HTML error page with status 500 on transient errors or 400
// on fatal ones.
func replyError(c context.Context, rw http.ResponseWriter, err error) {
- if errors.IsTransient(err) {
+ if transient.Tag.In(err) {
rw.WriteHeader(http.StatusInternalServerError)
} else {
rw.WriteHeader(http.StatusBadRequest)
@@ -135,7 +136,7 @@ func adminAutologin(c *router.Context, next router.Handler) {
url, err := auth.LoginURL(c.Context, destURL.String())
if err != nil {
logging.WithError(err).Errorf(c.Context, "Error when generating login URL")
- if errors.IsTransient(err) {
+ if transient.Tag.In(err) {
http.Error(c.Writer, "Transient error when generating login URL, see logs", 500)
} else {
http.Error(c.Writer, "Can't generate login URL, see logs", 401)

Powered by Google App Engine
This is Rietveld 408576698