Skip to content

Commit

Permalink
Merge pull request #229 from kilosonc/fix/error
Browse files Browse the repository at this point in the history
fix: improve error output
  • Loading branch information
kilosonc authored Jun 4, 2024
2 parents d125d34 + fad1a57 commit fbca5de
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/http/api/v1/idp/apis.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,12 @@ func (a *API) LoginCallback(c *gin.Context) {
)

if user, err = a.idpCtrl.LoginOrLink(c, code, state, redirect); err != nil {
if err = perror.Cause(err); errors.Is(err, herrors.ErrForbidden) {
if err := perror.Cause(err); errors.Is(err, herrors.ErrForbidden) {
response.AbortWithRPCError(c,
rpcerror.ForbiddenError.WithErrMsgf(
"this account is banned to sign in"))
return
} else if err = perror.Cause(err); errors.Is(err, herrors.ErrDuplicatedKey) {
} else if err := perror.Cause(err); errors.Is(err, herrors.ErrDuplicatedKey) {
response.AbortWithRPCError(c,
rpcerror.ConflictError.WithErrMsgf(
"idp already linked by another user"))
Expand Down

0 comments on commit fbca5de

Please sign in to comment.