@ms-cloudpack/retry
v0.1.2
Published
A retry manager for handling resilient operations with customizable retry policies i
Downloads
1,173
Keywords
Readme
@ms-cloudpack/retry
This package has a RetryManager class that can be used to retry operations that may fail due to transient errors.
Usage
import { RetryManager, type RetryPolicies } from '@ms-cloudpack/retry';
const policies: RetryPolicies[] = [
{
maxRetries: 1,
handle: (error) => {
return error instanceof Error && error.message.indexOf('The error that this policy is interested in') > -1;
},
wait: () => 0,
},
];
const retryManager = new RetryManager(policies);
retryManager.retry(() => {
// do something that may fail
});