Skip to content

Commit

Permalink
🎨 change arg order of errors.Is
Browse files Browse the repository at this point in the history
  • Loading branch information
iChemy committed Sep 16, 2024
1 parent f9c4d49 commit 5ac48d9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions router/users.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
func (h *Handlers) HandleGetUserMe(c echo.Context) error {
user, err := h.Repo.GetUserMe(getConinfo(c))
if err != nil {
if errors.Is(domain.ErrInvalidToken, err) {
if errors.Is(err, domain.ErrInvalidToken) {
return forbidden(err, message("token is invalid."), needAuthorization(true))
}
return judgeErrorResponse(err)
Expand All @@ -30,7 +30,7 @@ func (h *Handlers) HandleGetUsers(c echo.Context) error {

users, err := h.Repo.GetAllUsers(includeSuspend, true, getConinfo(c))
if err != nil {
if errors.Is(domain.ErrInvalidToken, err) {
if errors.Is(err, domain.ErrInvalidToken) {
return forbidden(err, message("token is invalid."), needAuthorization(true))
}
return judgeErrorResponse(err)
Expand Down

0 comments on commit 5ac48d9

Please sign in to comment.