0.1.2 • Published 1 year ago

@ms-cloudpack/retry v0.1.2

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

@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
});