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 TRPCError
s? (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.)1 Reply
That looks correct to me, errors get propagated to the client so you can handle them appropriately
What’s wrong in your view?
Oh sorry I missed 3 words 🤗
I’d need to check but I think the browser prints all network errors to the console regardless of handling
That’s something you may be able to disable in the browser dev tools