diff options
| -rw-r--r-- | packages/trpc/routers/apiKeys.ts | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/packages/trpc/routers/apiKeys.ts b/packages/trpc/routers/apiKeys.ts index b7d11d41..dc3a3527 100644 --- a/packages/trpc/routers/apiKeys.ts +++ b/packages/trpc/routers/apiKeys.ts @@ -112,7 +112,11 @@ export const apiKeysAppRouter = router({ .input(z.object({ apiKey: z.string() })) .output(z.object({ success: z.boolean() })) .mutation(async ({ input, ctx }) => { - await authenticateApiKey(input.apiKey, ctx.db); // Throws if the key is invalid + try { + await authenticateApiKey(input.apiKey, ctx.db); // Throws if the key is invalid + } catch { + throw new TRPCError({ code: "UNAUTHORIZED" }); + } return { success: true, }; |
