tRPCttRPC
Powered by
ReadorR
tRPC•3y ago•
16 replies
Reador

Express + tRPC: handle express errors from client

I currently have Express as backend and react on frontend.

I want to migrate gradually to tRPC + react query.

In order to do that I want to use the tRPC express middleware. I have tons of express middleware that I want to continue using for now, as well as error handlers.

The problem is that the tRPC client (trpc react query) does not recognize express errors like custom session timeout, 401, etc, which is normal, so I get the "Unable to transform response from server".

But I would like to know if there is an easy way to format express errors easily to tRPC errors, or if its possible to catch the error before tRPC client tries to transform it, so that I can handle it myself.
tRPCJoin
Move Fast & Break Nothing. End-to-end typesafe APIs made easy.
5,015Members
Resources
Recent Announcements

Similar Threads

Was this page helpful?

Similar Threads

how to handle non-trpc errors?
pupoPpupo / ❓-help
7mo ago
Express tRPC NextJS
MugetsuMMugetsu / ❓-help
3y ago
Trpc Vanilla client producing ts errors
MaxMMax / ❓-help
4y ago