Skip to content

Allow "throwing" in server streams #333

@masad-frost

Description

@masad-frost

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions