constwithRetry=require('hs-with-retry');constsomeThingAsync=()=>{/* some async operations */};asyncfunctionmain(){try{constret=awaitwithRetry({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();