Created
April 15, 2017 00:15
-
-
Save oieduardorabelo/7720d2624dac6a14f30e8aa0c21ac6d7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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