vercel / async-retry

Retrying made simple, easy and async
https://npmjs.com/async-retry
MIT License
1.85k stars 53 forks source link

The documentation for onRetry is wrong #92

Open BenJackGill opened 2 years ago

BenJackGill commented 2 years ago

The documentation currently says this:

onRetry: an optional Function that is invoked after a new retry is performed. It's passed the Error that triggered it as a parameter.

But it should say this:

onRetry: an optional Function that is invoked before a new retry is performed. It's passed the Error that triggered it as a parameter.

It's a small but significant difference.

I thought onRetry was useless because the docs say it runs after the retry. Then I tested and found it actually runs before the retry, which is much more useful. The docs should reflect that.

ChuckJonas commented 1 year ago

is it possible to "stop" the retry based on some condition?

EG only retry is status code == 501