mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-08-08 04:06:31 +08:00
Error code standardization
This commit is contained in:
parent
1d5e4a0f8a
commit
108685e8d0
@ -796,11 +796,11 @@ func FillPublicUserInfoByUserID(operationID, userID string, userInfo *open_im_sd
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func SetErr(ctx context.Context, err error, errCode *int32, errMsg *string) {
|
func SetErr(ctx context.Context, funcName string, err error, errCode *int32, errMsg *string, args ...interface{}) {
|
||||||
errInfo := constant.ToAPIErrWithErr(err)
|
errInfo := constant.ToAPIErrWithErr(err)
|
||||||
*errCode = errInfo.ErrCode
|
*errCode = errInfo.ErrCode
|
||||||
*errMsg = errInfo.ErrMsg
|
*errMsg = errInfo.ErrMsg
|
||||||
|
trace_log.SetContextInfo(ctx, funcName, err, args)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *groupServer) GetGroupApplicationList(ctx context.Context, req *pbGroup.GetGroupApplicationListReq) (*pbGroup.GetGroupApplicationListResp, error) {
|
func (s *groupServer) GetGroupApplicationList(ctx context.Context, req *pbGroup.GetGroupApplicationListReq) (*pbGroup.GetGroupApplicationListResp, error) {
|
||||||
@ -811,7 +811,7 @@ func (s *groupServer) GetGroupApplicationList(ctx context.Context, req *pbGroup.
|
|||||||
resp := pbGroup.GetGroupApplicationListResp{}
|
resp := pbGroup.GetGroupApplicationListResp{}
|
||||||
reply, err := imdb.GetRecvGroupApplicationList(req.FromUserID)
|
reply, err := imdb.GetRecvGroupApplicationList(req.FromUserID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
SetErr(nCtx, err, &resp.ErrCode, &resp.ErrMsg)
|
SetErr(nCtx, "GetRecvGroupApplicationList", err, &resp.ErrCode, &resp.ErrMsg, "userID ", req.FromUserID)
|
||||||
return &resp, nil
|
return &resp, nil
|
||||||
}
|
}
|
||||||
var errResult error
|
var errResult error
|
||||||
@ -836,7 +836,7 @@ func (s *groupServer) GetGroupApplicationList(ctx context.Context, req *pbGroup.
|
|||||||
resp.GroupRequestList = append(resp.GroupRequestList, &node)
|
resp.GroupRequestList = append(resp.GroupRequestList, &node)
|
||||||
}
|
}
|
||||||
if errResult != nil && len(resp.GroupRequestList) == 0 {
|
if errResult != nil && len(resp.GroupRequestList) == 0 {
|
||||||
SetErr(nCtx, err, &resp.ErrCode, &resp.ErrMsg)
|
SetErr(nCtx, "", errResult, &resp.ErrCode, &resp.ErrMsg)
|
||||||
return &resp, nil
|
return &resp, nil
|
||||||
}
|
}
|
||||||
trace_log.SetRpcRespInfo(nCtx, utils.GetSelfFuncName(), resp.String())
|
trace_log.SetRpcRespInfo(nCtx, utils.GetSelfFuncName(), resp.String())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user