Skip to content

Commit 3982184

Browse files
superlog-app[bot]Superlog app
andauthored
[superlog] Set correct HTTP status on custom ORPC error codes to suppress false-positive ERRORs (#509)
Co-authored-by: Superlog app <bot@superlog.sh>
1 parent d8ab8bf commit 3982184

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

packages/rpc/src/errors.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,14 @@ export const rpcError = {
7979
badRequest: (message?: string) => new ORPCError("BAD_REQUEST", { message }),
8080
featureUnavailable: (feature: string, requiredPlan?: string) =>
8181
new ORPCError("FEATURE_UNAVAILABLE", {
82+
status: 403,
8283
message: "This feature is not available on your current plan",
8384
data: { feature, requiredPlan },
8485
}),
8586
conflict: (message?: string) => new ORPCError("CONFLICT", { message }),
8687
rateLimited: (retryAfter = 60) =>
8788
new ORPCError("RATE_LIMITED", {
89+
status: 429,
8890
message: "Too many requests, please try again later",
8991
data: { retryAfter: normalizeRetryAfterSeconds(retryAfter) },
9092
}),
@@ -95,6 +97,7 @@ export const rpcError = {
9597
message?: string
9698
) =>
9799
new ORPCError("PLAN_LIMIT_EXCEEDED", {
100+
status: 402,
98101
message: message ?? "You have reached the limit for your current plan",
99102
data: { limit, current, nextPlan },
100103
}),

0 commit comments

Comments
 (0)