Skip to content

Commit

Permalink
fix noenc error by fixing Details error field
Browse files Browse the repository at this point in the history
As advised by @itizir in the discussion of grpc-ecosystem#551.

However, I've gone with the minimal change to make the error go away, I
haven't introduced a proper, generated protobuf definition.

Also, I've noticed our error body message there looks suspiciously like
Status[1], except for the field name "Error" vs "Message".

Fixes grpc-ecosystem#551.

[1]: https://github.com/google/go-genproto/blob/2b5a72b8730b0b/googleapis/rpc/status/status.pb.go#L83-L93

Signed-off-by: Stephan Renatus <srenatus@chef.io>
  • Loading branch information
srenatus committed Feb 24, 2018
1 parent 21563a1 commit 82232d2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions runtime/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ var (
)

type errorBody struct {
Error string `protobuf:"bytes,1,name=error" json:"error"`
Code int32 `protobuf:"varint,2,name=code" json:"code"`
Details []any.Any `protobuf:"bytes,3,name=details" json:"details"`
Error string `protobuf:"bytes,1,name=error" json:"error"`
Code int32 `protobuf:"varint,2,name=code" json:"code"`
Details []*any.Any `protobuf:"bytes,3,rep,name=details" json:"details,omitempty"`
}

// Make this also conform to proto.Message for builtin JSONPb Marshaler
Expand Down Expand Up @@ -103,7 +103,7 @@ func DefaultHTTPError(ctx context.Context, mux *ServeMux, marshaler Marshaler, w
if err != nil {
grpclog.Printf("Failed to marshal any: %v", err)
} else {
body.Details = append(body.Details, *a)
body.Details = append(body.Details, a)
}
}
}
Expand Down

0 comments on commit 82232d2

Please sign in to comment.