Skip to content
Junior–Senior166 views

Error handling in user Promise

Asked at

Task condition

Conduct a code review: analyze the deferred call reject in the implementation of the custom class MyPromise and verify the correctness of the catch() method.

const customPromise = new MyPromise((resolve, reject) => {
  setTimeout(reject, 2);
});

customPromise
  .then(() => console.log('[pm2] resolved 1'))
  .catch(() => console.log('[pm2] rejected'));
Frontend tasks in the code trainer