error-retry
Easy error handling for async functions or any function that returns a promise. Errors are retried with an exponential backoff delay between each attempt.
Install
$ npm install error-retry
Usage
var retry setMaxRetries = ; // Example function that just throws errors until called four times.var exampleCount = 0; { ++exampleCount console if exampleCount < 4 throw Error'example failure' return 'example success!'} { try // Call example() with error retry handling var result = await console catch ex console }
Max Retries
The default number of retries is 3. To modify this value call:
License
MIT license; see LICENSE.