* Determines the delay duration based on the error, prioritizing Retry-After header. * @param error The error object. * @returns An object containing the delay duration in milliseconds and the error status.
(error: unknown)
| 287 | * @returns An object containing the delay duration in milliseconds and the error status. |
| 288 | */ |
| 289 | function getDelayDurationAndStatus(error: unknown): { |
| 290 | delayDurationMs: number; |
| 291 | errorStatus: number | undefined; |
| 292 | } { |
| 293 | const errorStatus = getErrorStatus(error); |
| 294 | let delayDurationMs = 0; |
| 295 | |
| 296 | if (errorStatus === 429) { |
| 297 | delayDurationMs = getRetryAfterDelayMs(error); |
| 298 | } |
| 299 | return { delayDurationMs, errorStatus }; |
| 300 | } |
| 301 | |
| 302 | /** |
| 303 | * Logs a message for a retry attempt when using exponential backoff. |
no test coverage detected