RetryOps<A>
extension RetryOps<A> on IO<A>Extension provides the hook into retry capabilities for IO.
Methods
retrying() extension
IO<A> retrying(
RetryPolicy policy, {
(bool Function(A))? wasSuccessful,
(bool Function(Object))? isWorthRetrying,
(IO<Unit> Function(Object, RetryDetails))? onError,
(IO<Unit> Function(A, RetryDetails))? onFailure,
})Applies the given policy to this IO and will attempt to retry any failed attempts according to the policy.
wasSuccessful can be provided to further filter any successful evalations with undesirable results, so they may be retried.
isWorthRetrying can be provided to short-circuit any attempt to retry if some kind of error is encountered that may eliminate any need to retry.
onError can be provided to perform the given side-effect for each error eencounted.
onFailure can be provided in conjunction with wasSuccessful to perform the given side-effect when a successful evaluation fails to satisfy the wasSuccessful predicate.
Available on IO<A>, provided by the RetryOps<A> extension
Implementation
dart
IO<A> retrying(
RetryPolicy policy, {
Function1<A, bool>? wasSuccessful,
Function1<Object, bool>? isWorthRetrying,
Function2<Object, RetryDetails, IO<Unit>>? onError,
Function2<A, RetryDetails, IO<Unit>>? onFailure,
}) => _retryingImpl(
policy,
wasSuccessful ?? (_) => true,
isWorthRetrying ?? (_) => true,
onError ?? (_, _) => IO.unit,
onFailure ?? (_, _) => IO.unit,
RetryStatus.initial(),
this,
);