QuintenQ
tRPC2y ago
4 replies
Quinten

React Query client errors on 401

I'm throwing a TRPCError({ code: "UNAUTHORIZED" }) in a middleware, and handling error states returned from useQuery. However, each time I return a 401 with the TRPCError I get the following client error from the tRPC client. Why does it do this? It messes up my React as well (see the second error). I thought you were supposed to throw TRPCErrors? (Note: also using Tanstack Router, and running on Vinxi so it's all kinda experimental, do tell if that's what could be causing it.)
image.png
Was this page helpful?