Skip to content

Instantly share code, notes, and snippets.

@martianboy
Created March 4, 2016 08:03
Show Gist options
  • Save martianboy/13d520788598fbd667aa to your computer and use it in GitHub Desktop.
Save martianboy/13d520788598fbd667aa to your computer and use it in GitHub Desktop.
Retryable Promise
function retryable(fn, n) {
return fn().then(
undefined,
function(err) {
if (n > 0)
return retryable(fn, n - 1);
throw err;
}
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment