Skip to content

Instantly share code, notes, and snippets.

@s-taylor
Created September 27, 2017 22:54
Show Gist options
  • Save s-taylor/8d23770e69a42d8ebaeef6d7f6bf4eb0 to your computer and use it in GitHub Desktop.
Save s-taylor/8d23770e69a42d8ebaeef6d7f6bf4eb0 to your computer and use it in GitHub Desktop.
Understanding async await - part 10
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