diff options
| author | Taras Madan <tarasmadan@google.com> | 2023-07-21 11:51:35 +0200 |
|---|---|---|
| committer | Taras Madan <tarasmadan@google.com> | 2023-07-24 09:12:13 +0000 |
| commit | a36fe24b8383f6cd9b3519cd3eabdb9675d8992d (patch) | |
| tree | 3fef9a57760ccc4013289acd60e94e083db466e6 /dashboard/app/handler.go | |
| parent | 7549a7e1b57831cf6b08ce4700fc6e53417919f9 (diff) | |
all: use errors.As instead of .(type)
Diffstat (limited to 'dashboard/app/handler.go')
| -rw-r--r-- | dashboard/app/handler.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/dashboard/app/handler.go b/dashboard/app/handler.go index 6a115d0b2..6b72da0bb 100644 --- a/dashboard/app/handler.go +++ b/dashboard/app/handler.go @@ -50,7 +50,8 @@ func handleContext(fn contextHandler) http.Handler { http.Error(w, "403 Forbidden", http.StatusForbidden) return } - if redir, ok := err.(ErrRedirect); ok { + var redir *ErrRedirect + if errors.As(err, &redir) { http.Redirect(w, r, redir.Error(), http.StatusFound) return } @@ -201,7 +202,7 @@ func commonHeader(c context.Context, r *http.Request, w http.ResponseWriter, ns ns = adminPage } if ns != adminPage || !isAdminPage { - return nil, ErrRedirect{fmt.Errorf("/%v", ns)} + return nil, &ErrRedirect{fmt.Errorf("/%v", ns)} } } if ns != adminPage { |
