Error Handling

Throw typed errors with TRPCError and error codes (NOT_FOUND, UNAUTHORIZED, BAD_REQUEST, INTERNAL_SERVER_ERROR), configure errorFormatter for client-side Zod error display, handle errors globally with onError callback, map tRPC errors to HTTP status codes with getHTTPStatusCodeFromError().

trpc 803abbe 5.9 KB Updated

File contents

trpc/trpc/tree/main/packages/server/skills/error-handling commit 803abbef4a

Frequently asked questions

npx skillmds add trpc/error-handling