atmpt
provides an easy way to make promises retry based on exceptions
install
npm install atmpt
options
- delay (can be a number or function that returns a number, if its a function it gets called with an attempt argument)
- maxAttempts (the maximum amount of attempts)
examples
heres a basic retry example
await ;
and heres a little more advanced example with validation and custom delays
await ;