Created
October 1, 2019 13:14
-
-
Save dbayarchyk/b43872a25e20a07ac3eeec9432c74ef9 to your computer and use it in GitHub Desktop.
Async/await without try/catch in JavaScript
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 fetchAndUpdatePosts() { | |
const posts = await fetchPosts().catch(() => { | |
console.log('error in fetching posts'); | |
}); | |
if (posts) { | |
doSomethingWithPosts(posts); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment