Skip to content

Instantly share code, notes, and snippets.

@oieduardorabelo
Created April 15, 2017 00:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oieduardorabelo/7720d2624dac6a14f30e8aa0c21ac6d7 to your computer and use it in GitHub Desktop.
Save oieduardorabelo/7720d2624dac6a14f30e8aa0c21ac6d7 to your computer and use it in GitHub Desktop.
const superagent = require('superagent');
const NUM_RETRIES = 3;
test();
async function test() {
let i;
for (i = 0; i < NUM_RETRIES; ++i) {
try {
await superagent.get('http://google.com/this-throws-an-error');
break;
} catch(err) {}
}
console.log(i); // 3
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment