Skip to content

Instantly share code, notes, and snippets.

@abiodun0
Last active February 4, 2017 13:04
Show Gist options
  • Save abiodun0/f3259f1cf0e1b0f3a2051b7378525c7e to your computer and use it in GitHub Desktop.
Save abiodun0/f3259f1cf0e1b0f3a2051b7378525c7e to your computer and use it in GitHub Desktop.
function promiseFn(id) {
// replace this with your axios function, this is an asyn simulator
return new Promise(function(resolve, reject){
setTimeout(()=> resolve(id), 2000);
});
}
let makePromises = (result) => result.map(promiseFn);
Promise.all(makePromises([1,2,3,4,5])).then(function(r){
console.log(r)
throw new Error('Abiodun is a stupid guy')
}).catch(err => console.log('bleer',err));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment