add user not found

This commit is contained in:
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