0.1.0 • Published 5 years ago

hs-with-retry v0.1.0

Weekly downloads
4
License
MIT
Repository
github
Last release
5 years ago

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();