diff --git a/recipes/error-formatting.md b/recipes/error-formatting.md index 176dea7..b60290c 100644 --- a/recipes/error-formatting.md +++ b/recipes/error-formatting.md @@ -15,7 +15,7 @@ export const router = trpc.router() data: { ...shape.data, zodError: - error.code === 'BAD_USER_INPUT' + error.code === 'BAD_REQUEST' && error.cause instanceof ZodError ? error.cause.flatten() : null, @@ -27,5 +27,15 @@ export const router = trpc.router() ### Usage in Vue ```html + + ``` + +Learn more about error formatting [here](https://trpc.io/docs/error-formatting).