aboutsummaryrefslogtreecommitdiff
path: root/internal/auth
diff options
context:
space:
mode:
authorJoe Chen <jc@unknwon.io>2022-11-27 15:53:26 +0800
committerGitHub <noreply@github.com>2022-11-27 15:53:26 +0800
commit44333afd20a6312b617e0c33a497a4385ba3a250 (patch)
tree08550527657f6af16fab8d42b863cda4c34da095 /internal/auth
parent13099a7e4fe7565bb858646d42d1fba817cb06cc (diff)
chore: consistently use `errors.Cause` for identifying error types (#7264)
Diffstat (limited to 'internal/auth')
-rw-r--r--internal/auth/auth.go6
1 files changed, 5 insertions, 1 deletions
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
}