Skip to content

pchouzenoux/async-retry-decorator

Repository files navigation

async-retry-decorator

Typescript decorator base on async-retry

How to install

$ yarn add async-retry-decorator
$ npm install --save async-retry-decorator

Example

  import { retry } from 'async-retry-decorator';

  class Clazz {
    @retry({
      retries: 5,
      onRetry: (error, attempt) => {
        console.log(`Retry (${attempt}) on error`, error.message);
      },
    })
    public async method(): Promise<any> {
      // [...]
    }
  }

You can use all options available in async-retry directly in the decorator options