Created
April 17, 2019 08:56
-
-
Save SegersIan/6300a46206078e9e718059698808de01 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 thisThrows() { | |
throw new Error("Thrown from thisThrows()"); | |
} | |
async function myFunctionThatCatches() { | |
try { | |
return thisThrows(); | |
} catch (e) { | |
console.error(e); | |
} finally { | |
console.log('We do cleanup here'); | |
} | |
return "Nothing found"; | |
} | |
async function run() { | |
const myValue = await myFunctionThatCatches(); | |
console.log(myValue); | |
} | |
run(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment