sync
This commit is contained in:
@@ -13,13 +13,15 @@ class LimitError extends Error {
|
|||||||
}
|
}
|
||||||
export class RateLimitError extends LimitError {}
|
export class RateLimitError extends LimitError {}
|
||||||
export class FreeUsageLimitError extends LimitError {}
|
export class FreeUsageLimitError extends LimitError {}
|
||||||
|
export class BlackUsageLimitError extends LimitError {}
|
||||||
|
|
||||||
class SubscriptionUsageLimitError extends LimitError {
|
type LimitName = "5 hour" | "weekly" | "monthly"
|
||||||
|
export class GoUsageLimitError extends LimitError {
|
||||||
workspace: string
|
workspace: string
|
||||||
constructor(message: string, workspace: string, retryAfter?: number) {
|
limitName: LimitName
|
||||||
|
constructor(message: string, workspace: string, limitName: LimitName, retryAfter?: number) {
|
||||||
super(message, retryAfter)
|
super(message, retryAfter)
|
||||||
this.workspace = workspace
|
this.workspace = workspace
|
||||||
|
this.limitName = limitName
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export class GoUsageLimitError extends SubscriptionUsageLimitError {}
|
|
||||||
export class BlackUsageLimitError extends SubscriptionUsageLimitError {}
|
|
||||||
|
|||||||
@@ -415,8 +415,11 @@ export async function handler(
|
|||||||
message: error.message,
|
message: error.message,
|
||||||
},
|
},
|
||||||
metadata:
|
metadata:
|
||||||
error instanceof GoUsageLimitError || error instanceof BlackUsageLimitError
|
error instanceof GoUsageLimitError
|
||||||
? { workspace: error.workspace }
|
? {
|
||||||
|
workspace: error.workspace,
|
||||||
|
limitName: error.limitName,
|
||||||
|
}
|
||||||
: {},
|
: {},
|
||||||
}),
|
}),
|
||||||
{ status: 429, headers },
|
{ status: 429, headers },
|
||||||
@@ -710,7 +713,6 @@ export async function handler(
|
|||||||
t("zen.api.error.subscriptionQuotaExceeded", {
|
t("zen.api.error.subscriptionQuotaExceeded", {
|
||||||
retryIn: formatRetryTime(result.resetInSec),
|
retryIn: formatRetryTime(result.resetInSec),
|
||||||
}),
|
}),
|
||||||
authInfo.workspaceID,
|
|
||||||
result.resetInSec,
|
result.resetInSec,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -729,7 +731,6 @@ export async function handler(
|
|||||||
t("zen.api.error.subscriptionQuotaExceeded", {
|
t("zen.api.error.subscriptionQuotaExceeded", {
|
||||||
retryIn: formatRetryTime(result.resetInSec),
|
retryIn: formatRetryTime(result.resetInSec),
|
||||||
}),
|
}),
|
||||||
authInfo.workspaceID,
|
|
||||||
result.resetInSec,
|
result.resetInSec,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -757,6 +758,7 @@ export async function handler(
|
|||||||
throw new GoUsageLimitError(
|
throw new GoUsageLimitError(
|
||||||
t("zen.api.error.subscriptionQuotaExceededUseFreeModels"),
|
t("zen.api.error.subscriptionQuotaExceededUseFreeModels"),
|
||||||
authInfo.workspaceID,
|
authInfo.workspaceID,
|
||||||
|
"weekly",
|
||||||
result.resetInSec,
|
result.resetInSec,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -773,6 +775,7 @@ export async function handler(
|
|||||||
throw new GoUsageLimitError(
|
throw new GoUsageLimitError(
|
||||||
t("zen.api.error.subscriptionQuotaExceededUseFreeModels"),
|
t("zen.api.error.subscriptionQuotaExceededUseFreeModels"),
|
||||||
authInfo.workspaceID,
|
authInfo.workspaceID,
|
||||||
|
"monthly",
|
||||||
result.resetInSec,
|
result.resetInSec,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -789,6 +792,7 @@ export async function handler(
|
|||||||
throw new GoUsageLimitError(
|
throw new GoUsageLimitError(
|
||||||
t("zen.api.error.subscriptionQuotaExceededUseFreeModels"),
|
t("zen.api.error.subscriptionQuotaExceededUseFreeModels"),
|
||||||
authInfo.workspaceID,
|
authInfo.workspaceID,
|
||||||
|
"5 hour",
|
||||||
result.resetInSec,
|
result.resetInSec,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+2
-2
@@ -91,8 +91,8 @@ declare module "sst" {
|
|||||||
"type": "sst.sst.Secret"
|
"type": "sst.sst.Secret"
|
||||||
"value": string
|
"value": string
|
||||||
}
|
}
|
||||||
"INCIDENT_WEBHOOK_SIGNING_SECRET": {
|
"HoneycombWebhookSecret": {
|
||||||
"type": "sst.sst.Secret"
|
"type": "random.index/randomPassword.RandomPassword"
|
||||||
"value": string
|
"value": string
|
||||||
}
|
}
|
||||||
"R2AccessKey": {
|
"R2AccessKey": {
|
||||||
|
|||||||
+2
-2
@@ -91,8 +91,8 @@ declare module "sst" {
|
|||||||
"type": "sst.sst.Secret"
|
"type": "sst.sst.Secret"
|
||||||
"value": string
|
"value": string
|
||||||
}
|
}
|
||||||
"INCIDENT_WEBHOOK_SIGNING_SECRET": {
|
"HoneycombWebhookSecret": {
|
||||||
"type": "sst.sst.Secret"
|
"type": "random.index/randomPassword.RandomPassword"
|
||||||
"value": string
|
"value": string
|
||||||
}
|
}
|
||||||
"R2AccessKey": {
|
"R2AccessKey": {
|
||||||
|
|||||||
+2
-2
@@ -91,8 +91,8 @@ declare module "sst" {
|
|||||||
"type": "sst.sst.Secret"
|
"type": "sst.sst.Secret"
|
||||||
"value": string
|
"value": string
|
||||||
}
|
}
|
||||||
"INCIDENT_WEBHOOK_SIGNING_SECRET": {
|
"HoneycombWebhookSecret": {
|
||||||
"type": "sst.sst.Secret"
|
"type": "random.index/randomPassword.RandomPassword"
|
||||||
"value": string
|
"value": string
|
||||||
}
|
}
|
||||||
"R2AccessKey": {
|
"R2AccessKey": {
|
||||||
|
|||||||
Vendored
+2
-2
@@ -91,8 +91,8 @@ declare module "sst" {
|
|||||||
"type": "sst.sst.Secret"
|
"type": "sst.sst.Secret"
|
||||||
"value": string
|
"value": string
|
||||||
}
|
}
|
||||||
"INCIDENT_WEBHOOK_SIGNING_SECRET": {
|
"HoneycombWebhookSecret": {
|
||||||
"type": "sst.sst.Secret"
|
"type": "random.index/randomPassword.RandomPassword"
|
||||||
"value": string
|
"value": string
|
||||||
}
|
}
|
||||||
"R2AccessKey": {
|
"R2AccessKey": {
|
||||||
|
|||||||
Vendored
+2
-2
@@ -91,8 +91,8 @@ declare module "sst" {
|
|||||||
"type": "sst.sst.Secret"
|
"type": "sst.sst.Secret"
|
||||||
"value": string
|
"value": string
|
||||||
}
|
}
|
||||||
"INCIDENT_WEBHOOK_SIGNING_SECRET": {
|
"HoneycombWebhookSecret": {
|
||||||
"type": "sst.sst.Secret"
|
"type": "random.index/randomPassword.RandomPassword"
|
||||||
"value": string
|
"value": string
|
||||||
}
|
}
|
||||||
"R2AccessKey": {
|
"R2AccessKey": {
|
||||||
|
|||||||
Vendored
+2
-2
@@ -114,8 +114,8 @@ declare module "sst" {
|
|||||||
"type": "sst.sst.Secret"
|
"type": "sst.sst.Secret"
|
||||||
"value": string
|
"value": string
|
||||||
}
|
}
|
||||||
"INCIDENT_WEBHOOK_SIGNING_SECRET": {
|
"HoneycombWebhookSecret": {
|
||||||
"type": "sst.sst.Secret"
|
"type": "random.index/randomPassword.RandomPassword"
|
||||||
"value": string
|
"value": string
|
||||||
}
|
}
|
||||||
"LogProcessor": {
|
"LogProcessor": {
|
||||||
|
|||||||
Reference in New Issue
Block a user