mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-06-02 05:09:18 +08:00
Error code standardization
This commit is contained in:
parent
08bffa60f4
commit
8d42184ff0
@ -115,11 +115,12 @@ func (s *groupServer) Run() {
|
||||
log.NewInfo("", "group rpc success")
|
||||
}
|
||||
|
||||
func (s *groupServer) CreateGroup(ctx context.Context, req *pbGroup.CreateGroupReq) (resp *pbGroup.CreateGroupResp, _ error) {
|
||||
func (s *groupServer) CreateGroup(ctx context.Context, req *pbGroup.CreateGroupReq) (resp *pbGroup.CreateGroupResp, err error) {
|
||||
resp = &pbGroup.CreateGroupResp{CommonResp: &open_im_sdk.CommonResp{}}
|
||||
ctx = trace_log.NewRpcCtx(ctx, utils.GetSelfFuncName(), req.OperationID)
|
||||
trace_log.SetContextInfo(ctx, utils.GetSelfFuncName(), nil, "req", req, "resp", resp)
|
||||
trace_log.SetContextInfo(ctx, utils.GetSelfFuncName(), err, "req", req.String(), "resp", resp.String())
|
||||
defer trace_log.ShowLog(ctx)
|
||||
|
||||
if err := token_verify.CheckAccessV2(ctx, req.OpUserID, req.OwnerUserID); err != nil {
|
||||
SetErrorForResp(err, &resp.CommonResp.ErrCode, &resp.CommonResp.ErrMsg)
|
||||
return
|
||||
@ -791,11 +792,9 @@ func SetErrorForResp(err error, errCode *int32, errMsg *string) {
|
||||
}
|
||||
|
||||
func (s *groupServer) GetGroupApplicationList(ctx context.Context, req *pbGroup.GetGroupApplicationListReq) (resp *pbGroup.GetGroupApplicationListResp, err error) {
|
||||
defer func() {
|
||||
trace_log.SetContextInfo(ctx, utils.GetSelfFuncName(), err, "rpc req ", req.String(), "rpc resp ", resp.String())
|
||||
trace_log.ShowLog(ctx)
|
||||
}()
|
||||
ctx = trace_log.NewRpcCtx(ctx, utils.GetSelfFuncName(), req.OperationID)
|
||||
trace_log.SetContextInfo(ctx, utils.GetSelfFuncName(), err, "rpc req ", req.String(), "rpc resp ", resp.String())
|
||||
trace_log.ShowLog(ctx)
|
||||
|
||||
resp = &pbGroup.GetGroupApplicationListResp{CommonResp: &open_im_sdk.CommonResp{}}
|
||||
reply, err := imdb.GetRecvGroupApplicationList(req.FromUserID)
|
||||
|
@ -3,7 +3,6 @@ package trace_log
|
||||
import (
|
||||
"Open_IM/pkg/common/constant"
|
||||
"Open_IM/pkg/common/log"
|
||||
"Open_IM/pkg/utils"
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
@ -77,7 +76,7 @@ func SetContextInfo(ctx context.Context, funcName string, err error, args ...int
|
||||
var funcInfo FuncInfo
|
||||
funcInfo.Args = make(map[string]interface{})
|
||||
argsHandle(args, funcInfo.Args)
|
||||
funcInfo.FuncName = utils.GetSelfFuncName()
|
||||
funcInfo.FuncName = funcName
|
||||
funcInfo.Err = err
|
||||
*t.Funcs = append(*t.Funcs, funcInfo)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user