UNPKG

ring-websites-toolbelt

Version:

Ring Publishing Platform tool to work with Ring Websites

16 lines (12 loc) 277 B
module.exports = async function retryPromise(promiseFn, retries) { let error = null; while (retries > 0) { try { return await promiseFn(); } catch (err) { error = err; retries--; } } throw error; }