Typescript decorator base on async-retry
$ yarn add async-retry-decorator
$ npm install --save async-retry-decorator
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