| 110 | } |
| 111 | |
| 112 | export class ApiError extends HTTPException { |
| 113 | public readonly code: ErrorCodesType; |
| 114 | public readonly success: boolean; |
| 115 | public readonly rateLimit?: RateLimitErrorResponse; |
| 116 | public readonly docs?: string; |
| 117 | |
| 118 | constructor({ |
| 119 | status, |
| 120 | code, |
| 121 | message, |
| 122 | rateLimit, |
| 123 | docs |
| 124 | }: { |
| 125 | status?: StatusCode; |
| 126 | code: ErrorCodesType; |
| 127 | message: string; |
| 128 | rateLimit?: RateLimitErrorResponse; |
| 129 | docs?: string; |
| 130 | }) { |
| 131 | super(status || codeToStatus(code), { message }); |
| 132 | this.code = code; |
| 133 | this.success = false; |
| 134 | this.rateLimit = rateLimit; |
| 135 | this.docs = docs; |
| 136 | } |
| 137 | } |
| 138 | |
| 139 | export class ApiErrorZod extends HTTPException { |
| 140 | public readonly code: ErrorCodesType; |
nothing calls this directly
no outgoing calls
no test coverage detected