Calls callback until it doesn't throw an error or throws an error when maxRetries is reached. Similar to the waitUntil guard from '@augment-vir/assert' but doesn't check the callback's output.
callback
maxRetries
waitUntil
import {callWithRetries} from '@augment-vir/common';const result = callWithRetries(5, () => { if (Math.random() < 0.5) { return 'done'; } else { throw new Error(); }}); Copy
import {callWithRetries} from '@augment-vir/common';const result = callWithRetries(5, () => { if (Math.random() < 0.5) { return 'done'; } else { throw new Error(); }});
@augment-vir/common
Calls
callback
until it doesn't throw an error or throws an error whenmaxRetries
is reached. Similar to thewaitUntil
guard from '@augment-vir/assert' but doesn't check the callback's output.