Discussed in #49179
Originally posted by Sayan751 July 3, 2023
I have a gRPC service with JSON transcoding enabled. An endpoint of the service throws RpcException with same status code but different metadata. Examples:
throw new RpcException(new Status(StatusCode.InvalidArgument, "Whatever1"), new Metadata
{
{ "Code", Errors.Error1.ToString() }
});
throw new RpcException(new Status(StatusCode.InvalidArgument, "Whatever2"), new Metadata
{
{ "Code", Errors.Error2.ToString() }
});
Whoever, when I am making an HTTP call to the service, then I am getting the following:
{
"code": 3,
"message": "Whatever1",
"details": []
}
I expected the trailers to appear in the details array. Am I missing something here? At the end, I need a way to differentiate between the two errors with the same status code. Is that possible?