aryzingA
tRPCβ€’3y agoβ€’
5 replies
aryzing

What's the negative code returned in error responses?

What's the negative error code returned in errors responses and how is it meant to be used by the client?
Solution
tRPC is compliant with JSON-RPC and has specific error codes. You can find them here;
The docs have a great explanation on handling errors.
Whenever an error occurs in a procedure, tRPC responds to the client with an object that includes an "error" property. This property contains all the information that you need to handle the error in the client.
Error Handling | tRPC
GitHub
πŸ§™β€β™€οΈ Move Fast and Break Nothing. End-to-end typesafe APIs made easy. - trpc/trpc
trpc/packages/server/src/rpc/codes.ts at 43e0da13073c8e5426c4c4fb6c...
Was this page helpful?