Skip to content

Instantly share code, notes, and snippets.

@pacoccino
Created October 30, 2018 19:47
Show Gist options
  • Save pacoccino/ffc4e72c12e316595f8eeb0ee0a6cb87 to your computer and use it in GitHub Desktop.
Save pacoccino/ffc4e72c12e316595f8eeb0ee0a6cb87 to your computer and use it in GitHub Desktop.
error management Promise.all
const wait = (ms) => new Promise(resolve => setTimeout(resolve, ms));
(async () => {
await Promise.all([
(async () => {
console.log('a', '1');
await wait(100);
console.log('a', '2');
await wait(100);
console.log('a', '3');
throw new Error('poueta');
})(),
(async () => {
console.log('b', '1');
await wait(100);
console.log('b', '2');
throw new Error('pouetb');
})(),
]);
})().catch(console.error);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment