tRPCttRPC
Powered by
QuintenQ
tRPC•3y ago•
4 replies
Quinten

React Query client errors on 401

I'm throwing a
TRPCError({ code: "UNAUTHORIZED" })
TRPCError({ code: "UNAUTHORIZED" })
in a middleware, and handling error states returned from
useQuery
useQuery
. However, each time I return a 401 with the
TRPCError
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
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.)
image.png
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 Query Errors on client side (show toast on 401)
MattèoMMattèo / ❓-help
3y ago
Getting global query loading state on client (react)
Mighty EightMMighty Eight / ❓-help
9mo ago
Using both tRPC React client AND tRPC React Query client
anton.johanssonAanton.johansson / ❓-help
3y ago
React Query client and caller client under one object
LukaLLuka / ❓-help
3y ago