From 33c9e8bca54d753c7ea976dd178db0cd5408c218 Mon Sep 17 00:00:00 2001 From: MohamedBassem Date: Tue, 13 Feb 2024 00:29:25 +0000 Subject: feature: A usable, yet ugly browser extension --- packages/web/app/api/trpc/[trpc]/route.ts | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'packages/web/app/api') diff --git a/packages/web/app/api/trpc/[trpc]/route.ts b/packages/web/app/api/trpc/[trpc]/route.ts index e04539a9..aea9bc70 100644 --- a/packages/web/app/api/trpc/[trpc]/route.ts +++ b/packages/web/app/api/trpc/[trpc]/route.ts @@ -8,6 +8,13 @@ const handler = (req: Request) => endpoint: "/api/trpc", req, router: appRouter, + onError: ({ path, error }) => { + if (process.env.NODE_ENV === "development") { + console.error(`❌ tRPC failed on ${path}`); + } + console.error(error); + }, + createContext: async (opts) => { // TODO: This is a hack until we offer a proper REST API instead of the trpc based one. // Check if the request has an Authorization token, if it does, assume that API key authentication is requested. -- cgit v1.2.3-70-g09d2