connectrpc / connect-es

The TypeScript implementation of Connect: Protobuf RPC that works.

Home Page:https://connectrpc.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error handling with express connect middleware

sayyajp opened this issue · comments

Question

I want to handle error produced in ExpressConnectMiddleware.
But in ExpressConnectMiddleware, it doesn't seem to pass err like next(err).
So I can't handle error in express.
Is there any solution?

Thanks

Hey @sayyajp, we looked into this before in #551. Our middleware does end the request-response cycle. If an error occurs in an RPC, we write back an error response in the correct protocol-specific format. I am not sure how we could change behavior without causing issues.

How do you want to handle the error in express? Maybe there is an alternative to support your use case.

@timostamm Thanks for reply.
I might be able to resolve the problem when I follow comment.
If I should have problem yet, let me comment again.