tower-grpc icon indicating copy to clipboard operation
tower-grpc copied to clipboard

Is there a way to add error details in Status?

Open pepsighan opened this issue 5 years ago • 3 comments

When returning an error message via Status, we can only provide Code and message. There is currently no method provided to add details to it as far as I know.

It would be awesome to provide additional metadata to provide the client with additional contexts of the error.

pepsighan avatar Mar 10 '19 11:03 pepsighan

Did you see the details field of Status? It is for that. The convention is to put a protobuf message in it. I'm not sure if grpc offers a standard proto message type for it though.

per-gron avatar Mar 10 '19 22:03 per-gron

@per-gron There is a field details in Status but no way to modify that.

pepsighan avatar Mar 11 '19 02:03 pepsighan

It's true there isn't currently a way to add to the details method. I'm not especially familiar with the grpc.Status message type, but other grpc libraries seem to offer encoding one in the details of a Status. That's what this field is supposedly for... We haven't figured out the right way to add them yet, it seems, but I don't really know what that would be, either.

seanmonstar avatar Mar 11 '19 22:03 seanmonstar