Sobes.tech
Junior — Senior

Error handling in promise chain and its subsequent execution

livecode

Task condition

Analyze how the promise chain works when a rejection occurs, how errors are handled through catch, what impact the return value from the error handler has on subsequent .then calls, and how results are passed along the chain.

Promise.reject(5)
  .then(console.log)
  .catch((err) => {
    console.log(err);
    return 10;
  })
  .then(() => 10)
  .then((data) => console.log(data * 2));