Skip to content

Commit

Permalink
fix: improve error output
Browse files Browse the repository at this point in the history
Signed-off-by: Kiloson <[email protected]>
  • Loading branch information
kilosonc committed Jun 4, 2024
1 parent d125d34 commit fad1a57
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 fad1a57

Please sign in to comment.