The function that is to be retried. currentAttempt
represents the number of attempts
callback has been executed so far.
Returns an int representing the number of attempts it took to call fn
before it was successful.
Returns an array of all errors that have been passed to retryOperation.retry()
so far.
The returning array has the errors ordered chronologically based on when they were passed to
retryOperation.retry()
, which means the first passed error is at index zero and the last is at the last index.
A reference to the error object that occured most frequently.
Errors are compared using the error.message
property.
If multiple error messages occured the same amount of time, the last error object with that message is returned.
If no errors occured so far the value will be null
.
Resets the internal state of the operation object, so that you can call attempt()
again as if
this was a new operation object.
Returns false
when no error
value is given, or the maximum amount of retries has been reached.
Otherwise it returns true
, and retries the operation after the timeout for the current attempt number.
Stops the operation being retried. Useful for aborting the operation on a fatal error etc.
Generated using TypeDoc
Defines the function that is to be retried and executes it for the first time right away.