Skip to content

Instantly share code, notes, and snippets.

@dbayarchyk
Last active October 1, 2019 13:22
Show Gist options
  • Save dbayarchyk/d739fbd211347cd889badcd768105741 to your computer and use it in GitHub Desktop.
Save dbayarchyk/d739fbd211347cd889badcd768105741 to your computer and use it in GitHub Desktop.
Async/await without try/catch in JavaScript
function fetchAndUpdatePosts() {
fetchPosts()
.then((posts) => {
updatePosts(posts)
.catch((err) => {
console.log('error in updating posts');
});
})
.catch(() => {
console.log('error in fetching posts');
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment