Created
February 23, 2017 17:54
-
-
Save pveyes/33e7cfacf33cda2541b6eec002d2d2ed to your computer and use it in GitHub Desktop.
try catch async await
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 rejectedPromise = () => new Promise((resolve, reject) => { | |
setTimeout(() => reject(new Error('cuy')), 1000) | |
}) | |
const bw = async function () { | |
try { | |
await rejectedPromise(); | |
} catch (err) { | |
console.log('handle', err); | |
} | |
} | |
bw(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment