Grpc-gateway: Remove "error" field from errors.

Created on 14 Dec 2019  路  7Comments  路  Source: grpc-ecosystem/grpc-gateway

body := &errorBody{
        Error:   s.Message(),
        Message: s.Message(),
        Code:    int32(s.Code()),
        Details: s.Proto().GetDetails(),
}

Here (link)

The Error and Message both field got s.Message(), I think it's not clean to duplicate the same thing. I don't know if there's any special intention behind it.

Please let us know. Thanks.

breaking change help wanted

All 7 comments

Hi @cyantarek. The message field was added in https://github.com/grpc-ecosystem/grpc-gateway/pull/718 to make the error output of the gRPC-Gateway consistent with the Google RPC Status definitions JSON representation: https://github.com/googleapis/googleapis/blob/master/google/rpc/status.proto#L80. Unfortunately, because we already had error defined in our responses, we couldn't remove it without breaking backwards compatibility. So we've had to keep both. We hope to be able to remove the error field in a future 2.0 release (though there is currently no roadmap for when such a release might happen).

Hope that explains it!

We want to fix this for v2

Since it's a breaking change anyways, are we to just remove the field in internal/errors.proto, renumbering the others?

Sure thing

Actually, not sure we even need errors.proto anymore. We probably will just marshal the status.Status directly.

I've started looking into this. I'll include the status change. :)

This is done in v2.

Was this page helpful?
0 / 5 - 0 ratings