gin error handler
This commit is contained in:
@@ -212,7 +212,7 @@ func (a *Auth) AuthenticateAndAddIdentityToRequestGin(assertions ...Authorizatio
|
||||
if errors.Is(err, consts.ErrNotFound) {
|
||||
u, err := a.newLoginURL(ctx, a.auth, r.URL.String())
|
||||
if err != nil {
|
||||
response.WriteError(c, response.Errorf("failed to generate login url: %w", err))
|
||||
c.Error(response.Errorf("failed to generate login url: %w", err))
|
||||
c.Abort()
|
||||
return
|
||||
}
|
||||
@@ -222,7 +222,7 @@ func (a *Auth) AuthenticateAndAddIdentityToRequestGin(assertions ...Authorizatio
|
||||
return
|
||||
}
|
||||
|
||||
response.WriteError(c, response.Errorf("failed to authenticate: %w", err))
|
||||
c.Error(response.Errorf("failed to authenticate: %w", err))
|
||||
c.Abort()
|
||||
return
|
||||
}
|
||||
@@ -255,7 +255,7 @@ func (a *Auth) AuthenticateAndAddIdentityToRequestGin(assertions ...Authorizatio
|
||||
|
||||
user, acct, err := a.accts.GetUserAndAccountByAccessToken(ctx, accessToken)
|
||||
if err != nil {
|
||||
response.WriteError(c, response.Errorf("failed to authorize: %w", err))
|
||||
c.Error(response.Errorf("failed to authorize: %w", err))
|
||||
c.Abort()
|
||||
return
|
||||
}
|
||||
@@ -263,7 +263,7 @@ func (a *Auth) AuthenticateAndAddIdentityToRequestGin(assertions ...Authorizatio
|
||||
for _, as := range assertions {
|
||||
res, err := as(c)
|
||||
if err != nil {
|
||||
response.WriteError(c, err)
|
||||
c.Error(err)
|
||||
c.Abort()
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user