-
Notifications
You must be signed in to change notification settings - Fork 9
Description
UNCAUGHT_ERROR
is built into the protocol, it means the server encountered an internal error in processing the request.
We've noticed that people use this correctly when using unary rpcs but not all the time in streaming rpcs. The reason being is that if you're outside the main handler function (i.e. in a callback or background task), you have no way of triggering an internal error, throwing will not be caught by the handler.
This leads people to define error types that are basically unhandlable by the client and are effectively custom internal errors. This leads to bad error hygiene on the client side.
We should have a way to basically end the request with an uncaught, something like ctx.uncaught(new Error("something went wrong")), which would end the request following similar semantics as throwing within the handler.