mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-05-17 09:44:47 +08:00
Error code standardization
This commit is contained in:
parent
b81513e9bb
commit
9d791c186b
@ -885,8 +885,7 @@ func CheckPermission(ctx context.Context, groupID string, userID string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *groupServer) GroupApplicationResponse(ctx context.Context, req *pbGroup.GroupApplicationResponseReq) (*pbGroup.GroupApplicationResponseResp, error) {
|
func (s *groupServer) GroupApplicationResponse(ctx context.Context, req *pbGroup.GroupApplicationResponseReq) (*pbGroup.GroupApplicationResponseResp, error) {
|
||||||
ctx = trace_log.NewRpcCtx(ctx, utils.GetSelfFuncName(), req.OperationID)
|
trace_log.SetRpcReqInfo(trace_log.NewRpcCtx(ctx, utils.GetSelfFuncName(), req.OperationID), utils.GetSelfFuncName(), req.String())
|
||||||
trace_log.SetRpcReqInfo(ctx, utils.GetSelfFuncName(), req.String())
|
|
||||||
defer trace_log.ShowLog(ctx)
|
defer trace_log.ShowLog(ctx)
|
||||||
resp := pbGroup.GroupApplicationResponseResp{CommonResp: &pbGroup.CommonResp{}}
|
resp := pbGroup.GroupApplicationResponseResp{CommonResp: &pbGroup.CommonResp{}}
|
||||||
if err := CheckPermission(ctx, req.GroupID, req.OpUserID); err != nil {
|
if err := CheckPermission(ctx, req.GroupID, req.OpUserID); err != nil {
|
||||||
@ -944,7 +943,7 @@ func (s *groupServer) GroupApplicationResponse(ctx context.Context, req *pbGroup
|
|||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
err = (&imdb.GroupMember{}).Create(nCtx, []*imdb.GroupMember{&member})
|
err = (&imdb.GroupMember{}).Create(ctx, []*imdb.GroupMember{&member})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
SetErrorForResp(err, &resp.CommonResp.ErrCode, &resp.CommonResp.ErrMsg)
|
SetErrorForResp(err, &resp.CommonResp.ErrCode, &resp.CommonResp.ErrMsg)
|
||||||
return &resp, nil
|
return &resp, nil
|
||||||
@ -958,11 +957,11 @@ func (s *groupServer) GroupApplicationResponse(ctx context.Context, req *pbGroup
|
|||||||
cacheClient := pbCache.NewCacheClient(etcdCacheConn)
|
cacheClient := pbCache.NewCacheClient(etcdCacheConn)
|
||||||
cacheResp, err := cacheClient.DelGroupMemberIDListFromCache(context.Background(), &pbCache.DelGroupMemberIDListFromCacheReq{OperationID: req.OperationID, GroupID: req.GroupID})
|
cacheResp, err := cacheClient.DelGroupMemberIDListFromCache(context.Background(), &pbCache.DelGroupMemberIDListFromCacheReq{OperationID: req.OperationID, GroupID: req.GroupID})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
SetErr(nCtx, "DelGroupMemberIDListFromCache", err, &resp.CommonResp.ErrCode, &resp.CommonResp.ErrMsg, "groupID", req.GroupID)
|
SetErr(ctx, "DelGroupMemberIDListFromCache", err, &resp.CommonResp.ErrCode, &resp.CommonResp.ErrMsg, "groupID", req.GroupID)
|
||||||
return &resp, nil
|
return &resp, nil
|
||||||
}
|
}
|
||||||
if cacheResp.CommonResp.ErrCode != 0 {
|
if cacheResp.CommonResp.ErrCode != 0 {
|
||||||
SetErrCodeMsg(nCtx, "DelGroupMemberIDListFromCache", cacheResp.CommonResp.ErrCode, cacheResp.CommonResp.ErrMsg, &resp.CommonResp.ErrCode, &resp.CommonResp.ErrMsg)
|
SetErrCodeMsg(ctx, "DelGroupMemberIDListFromCache", cacheResp.CommonResp.ErrCode, cacheResp.CommonResp.ErrMsg, &resp.CommonResp.ErrCode, &resp.CommonResp.ErrMsg)
|
||||||
return &resp, nil
|
return &resp, nil
|
||||||
}
|
}
|
||||||
if err := rocksCache.DelGroupMemberListHashFromCache(req.GroupID); err != nil {
|
if err := rocksCache.DelGroupMemberListHashFromCache(req.GroupID); err != nil {
|
||||||
@ -979,7 +978,7 @@ func (s *groupServer) GroupApplicationResponse(ctx context.Context, req *pbGroup
|
|||||||
} else if req.HandleResult == constant.GroupResponseRefuse {
|
} else if req.HandleResult == constant.GroupResponseRefuse {
|
||||||
chat.GroupApplicationRejectedNotification(req)
|
chat.GroupApplicationRejectedNotification(req)
|
||||||
} else {
|
} else {
|
||||||
SetErr(nCtx, "", constant.ErrArgs, &resp.CommonResp.ErrCode, &resp.CommonResp.ErrMsg)
|
SetErr(ctx, "", constant.ErrArgs, &resp.CommonResp.ErrCode, &resp.CommonResp.ErrMsg)
|
||||||
return &resp, nil
|
return &resp, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user