Created
October 30, 2018 19:47
-
-
Save pacwoodson/2671d51eea0447ca6ddf10a603804555 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