Skip to content

Commit

Permalink
Incorrect error for listOverrides fix (#2734)
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelUnkey authored Dec 10, 2024
1 parent 1a15d6e commit 68dce8f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
1 change: 0 additions & 1 deletion apps/api/src/routes/v1_ratelimits_deleteOverride.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ export const registerV1RatelimitDeleteOverride = (app: App) =>
id: override.id,
},
],

context: { location: c.get("location"), userAgent: c.get("userAgent") },
});
});
Expand Down
5 changes: 4 additions & 1 deletion apps/api/src/routes/v1_ratelimits_listOverrides.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,10 @@ export const registerV1RatelimitListOverrides = (app: App) =>
),
});
if (!namespace) {
throw new Error(`Namespace ${namespaceId ? namespaceId : namespaceName} not found`);
throw new UnkeyApiError({
code: "NOT_FOUND",
message: `Namespace ${namespaceId ? namespaceId : namespaceName} not found`,
});
}

const [overrides, total] = await Promise.all([
Expand Down
4 changes: 2 additions & 2 deletions apps/api/src/routes/v1_ratelimits_setOverride.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { buildUnkeyQuery } from "@unkey/rbac";

const route = createRoute({
tags: ["ratelimit"],
operationId: "ratelimit.setOverride",
operationId: "setOverride",
method: "post",
path: "/v1/ratelimits.setOverride",
security: [{ bearerAuth: [] }],
Expand Down Expand Up @@ -112,7 +112,7 @@ export const registerV1RatelimitSetOverride = (app: App) =>
if (!namespace) {
throw new UnkeyApiError({
code: "NOT_FOUND",
message: "Namespace not found",
message: `Namespace ${req.namespaceId ? req.namespaceId : req.namespaceName} not found`,
});
}

Expand Down

0 comments on commit 68dce8f

Please sign in to comment.