Created
September 27, 2017 22:54
-
-
Save s-taylor/8d23770e69a42d8ebaeef6d7f6bf4eb0 to your computer and use it in GitHub Desktop.
Understanding async await - part 10
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
function fetchStuff(data) { | |
try { | |
const page = data.page; | |
return fetchResults(page) | |
.then(res => res.results); | |
} catch (err) { | |
return Promise.reject(err); | |
} | |
} | |
fetchStuff() | |
.catch(err => { /* handle error here */ }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment