Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error handling & formatting #143

Merged
merged 67 commits into from
Mar 7, 2021
Merged

error handling & formatting #143

merged 67 commits into from
Mar 7, 2021

Conversation

KATT
Copy link
Member

@KATT KATT commented Mar 5, 2021

see


changes:

  • add onError-fn
  • add formatError-fn
  • now passing procedure type to middlewares
  • managed to get rid of TMiddlewares-generic
  • update error handling
    • all server errors are TRPCError-instances
    • client errors get a .shape-object that is used is reflected from the formatError-fn

@KATT KATT added @trpc/server 🚧 wip work in progress labels Mar 5, 2021
@vercel
Copy link

vercel bot commented Mar 5, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployments, click below or on the icon next to each commit.

chat – ./examples/next-ssg-chat

🔍 Inspect: https://vercel.com/trpc/chat/4mX9d37YUHwRhnuLD2E1bGQCEJjh
✅ Preview: https://chat-git-feature-err.tmp.trpc.io

hello-world – ./examples/next-hello-world

🔍 Inspect: https://vercel.com/trpc/hello-world/92tKYLwM4PWvp2DNMG9DYZUYAKti
✅ Preview: https://hello-world-git-feature-err.tmp.trpc.io

www – ./www

🔍 Inspect: https://vercel.com/trpc/www/6URq7TSnDbot9s7rZTz321JXGzjy
✅ Preview: https://www-git-feature-err.tmp.trpc.io

todomvc – ./examples/next-prisma-todomvc

🔍 Inspect: https://vercel.com/trpc/todomvc/Ds9sFL3HHCsZQPnpLKCWigiZPe6W
✅ Preview: https://todomvc-git-feature-err.tmp.trpc.io

next-api-caching – ./examples/next-api-caching

🔍 Inspect: https://vercel.com/trpc/next-api-caching/ENDASDKmsGa72ZPQ2kdWKKk1mdMU
✅ Preview: https://next-api-caching-git-feature-err.tmp.trpc.io

Copy link
Contributor

@cyrus-za cyrus-za left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is awesome work! Thanks for putting the time in for getting it out. Check the uncommented code. Other than that it looks amazinf

packages/server/src/errors.ts Show resolved Hide resolved
packages/server/test/react.test.tsx Show resolved Hide resolved
www/docs/server/error-formatting.md Outdated Show resolved Hide resolved
Co-authored-by: Pieter Venter <pieter@venter.pro>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

formatError()-handler onError handler
3 participants