add user not found

This commit is contained in:
liangzai 2025-04-08 15:17:09 +08:00
parent 31d797a092
commit fa9869ccf2
2 changed files with 5 additions and 1 deletions

View File

@ -4,6 +4,7 @@ import (
"context"
"tydata-server/app/user/cmd/api/internal/svc"
"tydata-server/app/user/cmd/api/internal/types"
"tydata-server/app/user/model"
"tydata-server/common/ctxdata"
"tydata-server/common/xerr"
"tydata-server/pkg/lzkit/crypto"
@ -35,6 +36,9 @@ func (l *DetailLogic) Detail() (resp *types.UserInfoResp, err error) {
}
user, err := l.svcCtx.UserModel.FindOne(l.ctx, userID)
if err != nil {
if errors.Is(err, model.ErrNotFound) {
return nil, errors.Wrapf(xerr.NewErrCode(xerr.USER_NOT_FOUND), "用户信息, 用户不存在, %v", err)
}
return nil, errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR), "用户信息, 数据库查询用户信息失败, %v", err)
}
var userInfo types.User

View File

@ -14,7 +14,7 @@ const DB_ERROR uint32 = 100005
const DB_UPDATE_AFFECTED_ZERO_ERROR uint32 = 100006
const PARAM_VERIFICATION_ERROR uint32 = 100007
const CUSTOM_ERROR uint32 = 100008
const USER_NOT_FOUND uint32 = 100009
const LOGIN_FAILED uint32 = 200001
const LOGIC_QUERY_WAIT uint32 = 200002
const LOGIC_QUERY_ERROR uint32 = 200003