JSFiddle - React, Tailwind, and code Playground

by yshrkn

JavaScript

function taskA () {
  console.log("TaskA");
  throw new Error('Error');
}

function taskB () {
  console.log("TaskB");
}

function onRejected(error) {
  console.log(error);
}

var promise = new Promise((resolve, reject) => {
  resolve();
});

promise
  .then(taskA)
  .then(taskB)
  .catch(onRejected); // TaskA
                       // Error: Error at taskA ((index):31)