Closed jhump closed 3 years ago
@dragonsinth, I pushed another commit because I realized that we should treat "Cancelled" similarly to "DeadlineExceeded".
Not as certain about Cancelled.. I can see an argument for always 499'ing that.
Not as certain about Cancelled.. I can see an argument for always 499'ing that.
If the client has not actually cancelled, I don't think 499 is ever appropriate. That code is really for internal book-keeping as opposed to a code that we send to the client. (The client shouldn't ever be able to see one, since it means "client has closed the request".)
The provides a way for calling code to set a custom error renderer, to override the default mapping of gRPC errors to HTTP responses.
Since streams write the gRPC status into the body, as a trailing message, this is only for unary RPCs.
It also tweaks the existing mapping so that a
Cancelled
orDeadlineExceeded
code only maps to 499 when the request context is cancelled. Otherwise, a 502 Bad Gateway or 504 Gateway Timeout status is used, respectively.