Skip to content

Instantly share code, notes, and snippets.

@Gaafar
Last active February 21, 2018 02:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Gaafar/39b83dccf61ff9e86c5e31e297d96300 to your computer and use it in GitHub Desktop.
Save Gaafar/39b83dccf61ff9e86c5e31e297d96300 to your computer and use it in GitHub Desktop.
const makeRequest = () => {
return callAPromise()
.then(() => callAPromise())
.then(() => callAPromise())
.then(() => callAPromise())
.then(() => callAPromise())
.then(() => {
throw new Error("oops");
})
}
makeRequest()
.catch(err => {
console.log(err);
// output
// Error: oops at callAPromise.then.then.then.then.then (index.js:8:13)
})
@monteslu
Copy link

nitpick since you're not using the params, and the example made it seem a bit worse than it was:

const makeRequest = () => {
  return callAPromise()
    .then(callAPromise)
    .then(callAPromise)
    .then(callAPromise)
    .then(callAPromise)
    .then(() => {
      throw new Error("oops");
    })
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment