hs-with-retry

0.1.0 • Public • Published

Install

yarn add hs-with-retry

Usage

const withRetry = require('hs-with-retry');

const someThingAsync  = () => { /* some async operations */ };

async function main() {
  try {
    const ret = await withRetry({ attemptsTotal: 10, firstRetryDelay: 1000 })(someThingAsync);
    // `ret` will be the fullfilled result of someThingAsync
  } catch (err) {
    // `err` will be the error throwed in someThingAsync if it throws
  }
}

main();

Readme

Keywords

none

Package Sidebar

Install

npm i hs-with-retry

Weekly Downloads

1

Version

0.1.0

License

MIT

Unpacked Size

2 kB

Total Files

3

Last publish

Collaborators

  • haishanh