add user not found
This commit is contained in:
parent
31d797a092
commit
fa9869ccf2
@ -4,6 +4,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"tydata-server/app/user/cmd/api/internal/svc"
|
"tydata-server/app/user/cmd/api/internal/svc"
|
||||||
"tydata-server/app/user/cmd/api/internal/types"
|
"tydata-server/app/user/cmd/api/internal/types"
|
||||||
|
"tydata-server/app/user/model"
|
||||||
"tydata-server/common/ctxdata"
|
"tydata-server/common/ctxdata"
|
||||||
"tydata-server/common/xerr"
|
"tydata-server/common/xerr"
|
||||||
"tydata-server/pkg/lzkit/crypto"
|
"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)
|
user, err := l.svcCtx.UserModel.FindOne(l.ctx, userID)
|
||||||
if err != nil {
|
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)
|
return nil, errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR), "用户信息, 数据库查询用户信息失败, %v", err)
|
||||||
}
|
}
|
||||||
var userInfo types.User
|
var userInfo types.User
|
||||||
|
@ -14,7 +14,7 @@ const DB_ERROR uint32 = 100005
|
|||||||
const DB_UPDATE_AFFECTED_ZERO_ERROR uint32 = 100006
|
const DB_UPDATE_AFFECTED_ZERO_ERROR uint32 = 100006
|
||||||
const PARAM_VERIFICATION_ERROR uint32 = 100007
|
const PARAM_VERIFICATION_ERROR uint32 = 100007
|
||||||
const CUSTOM_ERROR uint32 = 100008
|
const CUSTOM_ERROR uint32 = 100008
|
||||||
|
const USER_NOT_FOUND uint32 = 100009
|
||||||
const LOGIN_FAILED uint32 = 200001
|
const LOGIN_FAILED uint32 = 200001
|
||||||
const LOGIC_QUERY_WAIT uint32 = 200002
|
const LOGIC_QUERY_WAIT uint32 = 200002
|
||||||
const LOGIC_QUERY_ERROR uint32 = 200003
|
const LOGIC_QUERY_ERROR uint32 = 200003
|
||||||
|
Loading…
Reference in New Issue
Block a user