diff --git a/gateway/server.go b/gateway/server.go index 80a44f0a..da155862 100644 --- a/gateway/server.go +++ b/gateway/server.go @@ -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()) + } } }