From 44333afd20a6312b617e0c33a497a4385ba3a250 Mon Sep 17 00:00:00 2001 From: Joe Chen Date: Sun, 27 Nov 2022 15:53:26 +0800 Subject: chore: consistently use `errors.Cause` for identifying error types (#7264) --- internal/auth/auth.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'internal/auth') diff --git a/internal/auth/auth.go b/internal/auth/auth.go index 2ae012d3..c1fef5fc 100644 --- a/internal/auth/auth.go +++ b/internal/auth/auth.go @@ -7,6 +7,8 @@ package auth import ( "fmt" + "github.com/pkg/errors" + "gogs.io/gogs/internal/errutil" ) @@ -40,8 +42,10 @@ type ErrBadCredentials struct { Args errutil.Args } +// IsErrBadCredentials returns true if the underlying error has the type +// ErrBadCredentials. func IsErrBadCredentials(err error) bool { - _, ok := err.(ErrBadCredentials) + _, ok := errors.Cause(err).(ErrBadCredentials) return ok } -- cgit v1.2.3