{"version":3,"file":"quota-exceeded-error.mjs","names":[],"sources":["../../../../../../../ai/src/errors/quota-exceeded-error.ts"],"sourcesContent":["import type { AIErrorOptions } from \"./ai-error\";\nimport type { ErrorCategory } from \"./error-category.type\";\nimport { ProviderError } from \"./provider-error\";\n\n/**\n * Provider refused the call because the account has exhausted its\n * paid quota (monthly credit, billing cap, subscription tier limit).\n *\n * **Not retryable.** Unlike `ProviderRateLimitError` — where the\n * bucket refills after `retryAfter` milliseconds — this one needs\n * human intervention: top up the account, upgrade the plan, or\n * switch to a different key. Consumers who blindly back-off-and-retry\n * on rate-limit errors would loop forever here, which is why the two\n * are split.\n *\n * Typically surfaced as OpenAI `code: \"insufficient_quota\"`.\n *\n * **Distinct from `BudgetExceededError`.** `QuotaExceededError` is\n * the *provider* telling us their billing cap is hit.\n * `BudgetExceededError` is our *own* middleware enforcing a\n * user-configured ceiling client-side.\n *\n * @example\n * if (result.error instanceof QuotaExceededError) {\n *   await pagerDuty.trigger(\"openai quota exhausted\");\n *   return fallbackResponse();\n * }\n */\nexport class QuotaExceededError extends ProviderError {\n  public static readonly defaultCategory: ErrorCategory = \"quota\";\n\n  public constructor(message: string, options?: AIErrorOptions) {\n    super(message, options, \"PROVIDER_QUOTA_EXCEEDED\");\n    this.name = \"QuotaExceededError\";\n  }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,IAAa,qBAAb,cAAwC,cAAc;;yBACI;;CAExD,AAAO,YAAY,SAAiB,SAA0B;EAC5D,MAAM,SAAS,SAAS,yBAAyB;EACjD,KAAK,OAAO;CACd;AACF"}