We have some trpc routers that make requests to another api - we use axios for that. I'd like to forward these errors to the frontend, so if that api errors with 401, that's what I'd like to see in the browser. If I just await the request and don't catch the errors, I get a 500 error where the message is the message from the axios request. What would be the best way to handle this, globally? I wouldn't really want to wrap each api in a try / catch, and I'd also ideally not need to translate those errors to TRPCErrors...
Continue the conversation
Join the Discord to ask follow-up questions and connect with the community
t
tRPC
Move Fast & Break Nothing. End-to-end typesafe APIs made easy.