From a36fe24b8383f6cd9b3519cd3eabdb9675d8992d Mon Sep 17 00:00:00 2001 From: Taras Madan Date: Fri, 21 Jul 2023 11:51:35 +0200 Subject: all: use errors.As instead of .(type) --- dashboard/app/handler.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'dashboard/app/handler.go') 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 { -- cgit mrf-deployment