From 3db0b31d31615d4a1f5d0fa423af6a50865f2e2c Mon Sep 17 00:00:00 2001 From: wobsoriano Date: Sun, 20 Aug 2023 21:55:25 -0700 Subject: [PATCH] refactor: use stand-alone getErrorShape --- src/index.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index 91af02c..581c8b8 100644 --- a/src/index.ts +++ b/src/index.ts @@ -12,6 +12,7 @@ import { import type { H3Event } from 'h3' import { createError, defineEventHandler, getRequestURL, isMethod, readBody } from 'h3' import type { TRPCResponse } from '@trpc/server/rpc' +import { getErrorShape } from '@trpc/server/shared' type MaybePromise = T | Promise @@ -94,10 +95,11 @@ export function createNuxtApiHandler ({ const path = getPath(event) if (path === null) { - const error = router.getErrorShape({ + const error = getErrorShape({ + config: router._def._config, error: new TRPCError({ message: - 'Param "trpc" not found - is the file named `[trpc]`.ts or `[...trpc].ts`?', + 'Query "trpc" not found - is the file named `[trpc]`.ts or `[...trpc].ts`?', code: 'INTERNAL_SERVER_ERROR' }), type: 'unknown',