|
|
|
@ -3,6 +3,12 @@ package mw
|
|
|
|
|
import (
|
|
|
|
|
"context"
|
|
|
|
|
"fmt"
|
|
|
|
|
"math"
|
|
|
|
|
"runtime"
|
|
|
|
|
"runtime/debug"
|
|
|
|
|
"strings"
|
|
|
|
|
|
|
|
|
|
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
|
|
|
|
|
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/log"
|
|
|
|
|
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/mw/specialerror"
|
|
|
|
|
"github.com/OpenIMSDK/Open-IM-Server/pkg/errs"
|
|
|
|
@ -12,10 +18,6 @@ import (
|
|
|
|
|
"google.golang.org/grpc/codes"
|
|
|
|
|
"google.golang.org/grpc/metadata"
|
|
|
|
|
"google.golang.org/grpc/status"
|
|
|
|
|
"math"
|
|
|
|
|
"runtime"
|
|
|
|
|
"runtime/debug"
|
|
|
|
|
"strings"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
const OperationID = "operationID"
|
|
|
|
@ -87,6 +89,7 @@ func rpcServerInterceptor(ctx context.Context, req interface{}, info *grpc.Unary
|
|
|
|
|
}
|
|
|
|
|
grpcStatus := status.New(codes.Code(code), codeErr.Msg())
|
|
|
|
|
var errInfo *errinfo.ErrorInfo
|
|
|
|
|
if config.Config.Log.WithStack {
|
|
|
|
|
if unwrap != err {
|
|
|
|
|
sti, ok := err.(interface{ StackTrace() errors.StackTrace })
|
|
|
|
|
if ok {
|
|
|
|
@ -108,6 +111,7 @@ func rpcServerInterceptor(ctx context.Context, req interface{}, info *grpc.Unary
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if errInfo == nil {
|
|
|
|
|
errInfo = &errinfo.ErrorInfo{Cause: err.Error()}
|
|
|
|
|
}
|
|
|
|
|