8 lines
191 B
JavaScript
8 lines
191 B
JavaScript
|
export const retry = (toRetry, maxRetries) => {
|
||
|
let promise = toRetry();
|
||
|
for (let i = 0; i < maxRetries; i++) {
|
||
|
promise = promise.catch(toRetry);
|
||
|
}
|
||
|
return promise;
|
||
|
};
|