fix: handling rpc error on gateway (#2212)

master
Kevin Wan 2 years ago committed by GitHub
parent 91b8effb24
commit 49367f1713
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -16,6 +16,7 @@ import (
"github.com/zeromicro/go-zero/rest"
"github.com/zeromicro/go-zero/rest/httpx"
"github.com/zeromicro/go-zero/zrpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/reflection/grpc_reflection_v1alpha"
)
@ -135,6 +136,11 @@ func (s *Server) buildHandler(source grpcurl.DescriptorSource, resolver jsonpb.A
handler, parser.Next); err != nil {
httpx.Error(w, err)
}
st := handler.Status
if st.Code() != codes.OK {
httpx.Error(w, st.Err())
}
}
}

Loading…
Cancel
Save