A self-hostable bookmark-everything app (links, notes and images) with AI-based automatic tagging and full text search
fix: fix 5xx on invalid api key
Mohamed Bassem20f4e4712f33
diff --git a/packages/trpc/routers/apiKeys.ts b/packages/trpc/routers/apiKeys.tsindex 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,};