Repository navigation
Improve handling of HTTP statuses & headers - #811
Conversation
# Conflicts: # examples/next-prisma-starter/src/pages/index.tsx
# Conflicts: # examples/next-prisma-starter/src/pages/index.tsx # examples/next-prisma-starter/src/pages/post/[id].tsx # packages/server/src/router.ts # packages/server/test/react.test.tsx
|
This pull request is being automatically deployed with Vercel (learn more). www β ./wwwπ Inspect: https://vercel.com/trpc/www/2oDQvKQjyKsFjDyn33j2YvgWW3gL todomvc β ./examples/next-prisma-todomvcπ Inspect: https://vercel.com/trpc/todomvc/69y3qKJyi7YB3UvnWBKm95HhXAeu |
cyrus-za
left a comment
There was a problem hiding this comment.
Thanks for this. Can't wait to use it
8284395 to
e1a71a0
Compare
This PR enables Next.js to send actual
404status codes for instance when doing SSR.httpStatusas part of error object as the default error shapehttpStatuswill be used to determine the actual HTTP Status code setTRPCClientError.dataas a shortcut toerror.shape.dataas that's the only one I find myself usingErrorFormatter-datahas to be aRecord<string, unknown>TRPCErrorwe infer in@trpc/reactis nowTRPCErrorLikeand is serialized for SSR in@trpc/nextresponseMeta()that is triggered before a request ends - both as part of@trpc/next&@trpc/server@trpc/serverreceivestype,paths,errors, and the unserializeddata[]that is going out@trpc/nextit client errorsSee docs at π https://www-git-feature-error-example.tmp.trpc.io/
Next.js error example
For a reference on how to use this you can do a component like the following:
In
withTRPC()In page