package grpcx import ( "github.com/pkg/errors" "google.golang.org/grpc/status" ) func WrapGrpcErr(e error) (code int32, msg string, err error) { err = e cause := errors.Cause(err) gStatus, ok := status.FromError(cause) if ok { code = int32(gStatus.Code()) msg = gStatus.Message() } else { code = 500 msg = cause.Error() } return }