Theo Gravity
Theo Gravity2y ago

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
Error Formatting | tRPC
The error formatting in your router will be inferred all the way to your client (& React components)
Solution:
Ah, it was a dumb question. It has nothing to do with adapters. ```ts const t = initTRPC.context<OuterContext>().create({ errorFormatter({ shape }) {...
Jump to solution
1 Reply
Solution
Theo Gravity
Theo Gravity2y ago
Ah, it was a dumb question. It has nothing to do with adapters.
const t = initTRPC.context<OuterContext>().create({
errorFormatter({ shape }) {

}
});

export const router = t.router;
export const middleware = t.middleware;
export const mergeRouters = t.mergeRouters;
export const procedure = t.procedure;
const t = initTRPC.context<OuterContext>().create({
errorFormatter({ shape }) {

}
});

export const router = t.router;
export const middleware = t.middleware;
export const mergeRouters = t.mergeRouters;
export const procedure = t.procedure;