Last active
July 21, 2016 21:44
-
-
Save xjamundx/c7454a0072fb42f70ec5548759c2678a to your computer and use it in GitHub Desktop.
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
// rely on try/catch around the awaited Promise | |
async function doSomething() { | |
try { | |
let data = await getData() | |
} catch (err) { | |
console.error(err) | |
} | |
} | |
// add a catch handler | |
function doSomething() { | |
return getData().catch(err => { | |
console.error(err) | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment