Created
February 3, 2017 12:58
-
-
Save edorivai/01308d3f0c52e21224360513125cf1dc to your computer and use it in GitHub Desktop.
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
async function() { | |
try { | |
const someValue = await getSomeValue(); | |
doSomethingWith(someValue); | |
} catch (error) { | |
console.error(error); | |
} | |
} | |
async function() { | |
let someValue; | |
try { | |
someValue = await getSomeValue(); | |
} catch (error) { | |
console.error(error); | |
return; | |
} | |
if (!someValue) return; | |
doSomethingWith(someValue); | |
} | |
async function() { | |
const someValue = await getSomeValue().catch(console.error.bind(console)); | |
if (!someValue) return; | |
doSomethingWith(someValue); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment