From 2da5bfafe05e07c9401137126e55eb0ca4f76472 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Thu, 29 Aug 2019 18:08:17 -0700 Subject: [PATCH] Fix hand-crafted protobuf message (#1016) errorBody is an improperly hand-crafted protobuf Message. In particular, field number 1 is used twice, causing this to message to crash in the v2 re-implementation of Go protobufs. This PR modifies the field numbers to be unique. Since Error is a special field not in status.proto, we choose a large field number to avoid conflicting with any new field that may be added to the real Status message. We also fix the field numbers to truly match up with Status. Signed-off-by: Bryce Harrington --- runtime/errors.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/runtime/errors.go b/runtime/errors.go index ad94578..a360807 100644 --- a/runtime/errors.go +++ b/runtime/errors.go @@ -66,12 +66,12 @@ var ( ) type errorBody struct { - Error string `protobuf:"bytes,1,name=error" json:"error"` + Error string `protobuf:"bytes,100,name=error" json:"error"` // This is to make the error more compatible with users that expect errors to be Status objects: // https://github.com/grpc/grpc/blob/master/src/proto/grpc/status/status.proto // It should be the exact same message as the Error field. - Message string `protobuf:"bytes,1,name=message" json:"message"` - Code int32 `protobuf:"varint,2,name=code" json:"code"` + Code int32 `protobuf:"varint,1,name=code" json:"code"` + Message string `protobuf:"bytes,2,name=message" json:"message"` Details []*any.Any `protobuf:"bytes,3,rep,name=details" json:"details,omitempty"` } -- 2.25.1