(error: unknown)
| 221 | } |
| 222 | |
| 223 | function isReplicateApiError(error: unknown): error is ApiError { |
| 224 | if (typeof error !== "object" || error === null) { |
| 225 | return false; |
| 226 | } |
| 227 | |
| 228 | const apiError = error as ApiError; |
| 229 | |
| 230 | return ( |
| 231 | apiError.name === "ApiError" && |
| 232 | apiError.request instanceof Request && |
| 233 | apiError.response instanceof Response |
| 234 | ); |
| 235 | } |
| 236 | |
| 237 | function shouldRetry(method: string, status: number) { |
| 238 | return status === 429 || (method === "GET" && status >= 500); |
no outgoing calls
no test coverage detected
searching dependent graphs…