File size: 973 Bytes
5f24abe
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
export class AuthError extends Error {}
export class CreditsError extends Error {}
export class MonthlyLimitError extends Error {}
export class UserLimitError extends Error {}
export class ModelError extends Error {}
export class RegionError extends Error {}
export class DataPolicyError extends Error {}

class LimitError extends Error {
  retryAfter?: number
  constructor(message: string, retryAfter?: number) {
    super(message)
    this.retryAfter = retryAfter
  }
}
export class RateLimitError extends LimitError {}
export class FreeUsageLimitError extends LimitError {}
export class BlackUsageLimitError extends LimitError {}

type LimitName = "5 hour" | "weekly" | "monthly"
export class GoUsageLimitError extends LimitError {
  workspace: string
  limitName: LimitName
  constructor(message: string, workspace: string, limitName: LimitName, retryAfter?: number) {
    super(message, retryAfter)
    this.workspace = workspace
    this.limitName = limitName
  }
}