aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorMohamed Bassem <me@mbassem.com>2025-09-07 20:19:52 +0000
committerMohamed Bassem <me@mbassem.com>2025-09-07 20:19:52 +0000
commit20f4e4712f332a05030a0f248a2caa8d91ec2a36 (patch)
tree6926b288b49b519fdcbbfff4bf41ac9cdf9d058a /packages
parente5dea9568b9bb8b267cf89f2c30fa578edef6a3e (diff)
downloadkarakeep-20f4e4712f332a05030a0f248a2caa8d91ec2a36.tar.zst
fix: fix 5xx on invalid api key
Diffstat (limited to '')
-rw-r--r--packages/trpc/routers/apiKeys.ts6
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,
};