Theo Gravity
Theo Gravity
TtRPC
Created by Theo Gravity on 6/12/2023 in #❓-help
How to use the errorFormatter when using an adapter?
The example here uses context.create(), which isn't something you do when using an adapter. I don't see an errorFormatter exposed in createExpressMiddleware() https://trpc.io/docs/server/error-formatting
4 replies
TtRPC
Created by Theo Gravity on 6/10/2023 in #❓-help
How do I log thrown errors from the query/ mutation on the server side globally?
I was surprised to find that the server servicing tRPC requests do not log any thrown errors from a query / mutation to the console by default (but the client does capture errors). I want to be able to log all errors on the server side. How would I do this? This page doesn't really give me any clues as I don't know what trpcNext.createNextApiHandler refers to: https://trpc.io/docs/server/error-handling#handling-errors I am using the express adapter with tRPC. I do not want to have to attach an error handling function to each query / mutation I define.
9 replies