Created
October 30, 2018 19:47
-
-
Save pacwoodson/ffc4e72c12e316595f8eeb0ee0a6cb87 to your computer and use it in GitHub Desktop.
error management Promise.all
This file contains hidden or 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 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