Loading problem…
This problem builds on abortable-fetch-wrapper. Complete that first, then load your solution to continue.
Extend the basic abortableFetch wrapper by adding automatic network retry logic.
Network environments are fundamentally flaky. Requests fail due to DNS blips, dropped packets, or momentary server overload. Implementing a transparent retry strategy prevents these micro-failures from bubbling up to the user as fatal errors.
Implement
Options Signature:
timeoutMs (optional)retries (default 0): The maximum number of retry attempts after the initial failure.retryDelayMs (default 0): Backoff duration between a failure and the next attempt.retryDelayMs using a non-blocking timeout primitive before issuing the next attempt.timeoutMs, that specific attempt fails with TimeoutError and triggers a retry.retries are exhausted, reject the Promise with the specific error produced by the final failed attempt.