Skip to content

Instantly share code, notes, and snippets.

@pveyes
Created February 23, 2017 17:54
Show Gist options
  • Save pveyes/33e7cfacf33cda2541b6eec002d2d2ed to your computer and use it in GitHub Desktop.
Save pveyes/33e7cfacf33cda2541b6eec002d2d2ed to your computer and use it in GitHub Desktop.
try catch async await
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