diff options
author | Joe Chen <jc@unknwon.io> | 2022-11-27 15:53:26 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-27 15:53:26 +0800 |
commit | 44333afd20a6312b617e0c33a497a4385ba3a250 (patch) | |
tree | 08550527657f6af16fab8d42b863cda4c34da095 /internal/route/lfs/route.go | |
parent | 13099a7e4fe7565bb858646d42d1fba817cb06cc (diff) |
chore: consistently use `errors.Cause` for identifying error types (#7264)
Diffstat (limited to 'internal/route/lfs/route.go')
-rw-r--r-- | internal/route/lfs/route.go | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/internal/route/lfs/route.go b/internal/route/lfs/route.go index b2ab2b0c..3440c89b 100644 --- a/internal/route/lfs/route.go +++ b/internal/route/lfs/route.go @@ -8,7 +8,6 @@ import ( "net/http" "strings" - "github.com/pkg/errors" "gopkg.in/macaron.v1" log "unknwon.dev/clog/v2" @@ -76,15 +75,15 @@ func authenticate() macaron.Handler { // or password as the token. if auth.IsErrBadCredentials(err) { user, err = context.AuthenticateByToken(c.Req.Context(), username) - if err != nil && !db.IsErrAccessTokenNotExist(errors.Cause(err)) { + if err != nil && !db.IsErrAccessTokenNotExist(err) { internalServerError(c.Resp) log.Error("Failed to authenticate by access token via username: %v", err) return - } else if db.IsErrAccessTokenNotExist(errors.Cause(err)) { + } else if db.IsErrAccessTokenNotExist(err) { // Try again using the password field as the token. user, err = context.AuthenticateByToken(c.Req.Context(), password) if err != nil { - if db.IsErrAccessTokenNotExist(errors.Cause(err)) { + if db.IsErrAccessTokenNotExist(err) { askCredentials(c.Resp) } else { c.Status(http.StatusInternalServerError) |