We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e5dea95 commit 20f4e47Copy full SHA for 20f4e47
packages/trpc/routers/apiKeys.ts
@@ -112,7 +112,11 @@ export const apiKeysAppRouter = router({
112
.input(z.object({ apiKey: z.string() }))
113
.output(z.object({ success: z.boolean() }))
114
.mutation(async ({ input, ctx }) => {
115
- await authenticateApiKey(input.apiKey, ctx.db); // Throws if the key is invalid
+ try {
116
+ await authenticateApiKey(input.apiKey, ctx.db); // Throws if the key is invalid
117
+ } catch {
118
+ throw new TRPCError({ code: "UNAUTHORIZED" });
119
+ }
120
return {
121
success: true,
122
};
0 commit comments