|
|
|
@ -2,7 +2,6 @@ package nstatus
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"context"
|
|
|
|
|
"github.com/pkg/errors"
|
|
|
|
|
"google.golang.org/grpc"
|
|
|
|
|
"google.golang.org/grpc/codes"
|
|
|
|
|
"google.golang.org/grpc/metadata"
|
|
|
|
@ -16,8 +15,7 @@ func UnaryServerInterceptor() grpc.UnaryServerInterceptor {
|
|
|
|
|
return func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp interface{}, err error) {
|
|
|
|
|
resp, err = handler(ctx, req)
|
|
|
|
|
if err != nil {
|
|
|
|
|
cause := errors.Cause(err)
|
|
|
|
|
e := ConvertErr(cause)
|
|
|
|
|
e := ConvertErr(err)
|
|
|
|
|
if e != nil {
|
|
|
|
|
writeResultTypeCtx(ctx, e)
|
|
|
|
|
// 转换为grpc-err
|
|
|
|
|