(status: number)
| 328 | } |
| 329 | |
| 330 | export function getErrorCode(status: number): string { |
| 331 | const codes: Record<number, string> = { |
| 332 | 400: "BAD_REQUEST", |
| 333 | 401: "UNAUTHORIZED", |
| 334 | 402: "PAYMENT_REQUIRED", |
| 335 | 403: "FORBIDDEN", |
| 336 | 404: "NOT_FOUND", |
| 337 | 405: "METHOD_NOT_ALLOWED", |
| 338 | 409: "CONFLICT", |
| 339 | 422: "UNPROCESSABLE_ENTITY", |
| 340 | 429: "RATE_LIMITED", |
| 341 | 500: "INTERNAL_ERROR", |
| 342 | 502: "BAD_GATEWAY", |
| 343 | 503: "SERVICE_UNAVAILABLE", |
| 344 | }; |
| 345 | return codes[status] || "UNKNOWN_ERROR"; |
| 346 | } |
| 347 | |
| 348 | export const KNOWN_ERROR_STATUS_CODES = [ |
| 349 | 400, 401, 402, 403, 405, 409, 422, 426, 429, 500, 502, 503, |
no outgoing calls
no test coverage detected