Skip to content
Permalink
Browse files

Merge pull request #113 from bilibili/remove-ecode-pb

hidden deprecated package
  • Loading branch information...
tomwei7 committed May 21, 2019
2 parents 6d2a0f4 + 92ac678 commit 50b05a7b78139a3005984267ec4f7f60b0064841
@@ -10,13 +10,11 @@ import (
"time"

"github.com/bilibili/kratos/pkg/ecode"
epb "github.com/bilibili/kratos/pkg/ecode/pb"
"github.com/bilibili/kratos/pkg/log"
"github.com/bilibili/kratos/pkg/net/rpc/warden"
pb "github.com/bilibili/kratos/pkg/net/rpc/warden/internal/proto/testproto"
xtime "github.com/bilibili/kratos/pkg/time"

"github.com/golang/protobuf/ptypes"
"google.golang.org/grpc"
)

@@ -26,9 +24,7 @@ type helloServer struct {

func (s *helloServer) SayHello(ctx context.Context, in *pb.HelloRequest) (*pb.HelloReply, error) {
if in.Name == "err_detail_test" {
any, _ := ptypes.MarshalAny(&pb.HelloReply{Success: true, Message: "this is test detail"})
err := epb.From(ecode.AccessDenied)
err.ErrDetail = any
err, _ := ecode.Error(ecode.AccessDenied, "AccessDenied").WithDetails(&pb.HelloReply{Success: true, Message: "this is test detail"})
return nil, err
}
return &pb.HelloReply{Message: fmt.Sprintf("hello %s from %s", in.Name, s.addr)}, nil
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -11,7 +11,7 @@ import (
"google.golang.org/grpc/status"

"github.com/bilibili/kratos/pkg/ecode"
"github.com/bilibili/kratos/pkg/ecode/pb"
"github.com/bilibili/kratos/pkg/net/rpc/warden/internal/pb"
)

// togRPCCode convert ecode.Codo to gRPC code
@@ -15,7 +15,7 @@ import (
"google.golang.org/grpc/status"

"github.com/bilibili/kratos/pkg/ecode"
"github.com/bilibili/kratos/pkg/ecode/pb"
"github.com/bilibili/kratos/pkg/net/rpc/warden/internal/pb"
)

func TestCodeConvert(t *testing.T) {

0 comments on commit 50b05a7

Please sign in to comment.
You can’t perform that action at this time.