(status, errorResponse, message, headers)
| 68969 | if (status) { |
| 68970 | return `${status} status code (no body)`; |
| 68971 | } |
| 68972 | if (msg) { |
| 68973 | return msg; |
| 68974 | } |
| 68975 | return "(no status code or body)"; |
| 68976 | } |
| 68977 | static generate(status, errorResponse, message, headers) { |
| 68978 | if (!status) { |
| 68979 | return new APIConnectionError({ cause: castToError(errorResponse) }); |
| 68980 | } |
| 68981 | const error = errorResponse; |
| 68982 | if (status === 400) { |
| 68983 | return new BadRequestError(status, error, message, headers); |
| 68984 | } |
| 68985 | if (status === 401) { |
| 68986 | return new AuthenticationError(status, error, message, headers); |
| 68987 | } |
| 68988 | if (status === 403) { |
| 68989 | return new PermissionDeniedError(status, error, message, headers); |
| 68990 | } |
| 68991 | if (status === 404) { |
| 68992 | return new NotFoundError(status, error, message, headers); |
| 68993 | } |
| 68994 | if (status === 409) { |
| 68995 | return new ConflictError(status, error, message, headers); |
| 68996 | } |
| 68997 | if (status === 422) { |
| 68998 | return new UnprocessableEntityError(status, error, message, headers); |
| 68999 | } |
| 69000 | if (status === 429) { |
| 69001 | return new RateLimitError(status, error, message, headers); |
| 69002 | } |
| 69003 | if (status >= 500) { |
| 69004 | return new InternalServerError(status, error, message, headers); |
nothing calls this directly
no test coverage detected