reador23
reador23
TtRPC
Created by reador23 on 7/6/2023 in #❓-help
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.
17 replies