JSFiddle - React, Tailwind, and code Playground

by TheDiamondDoge

JavaScript

let promise = new Promise((resolve, reject) => {
  // setTimeout(() => resolve('DONE'), 1000);
  setTimeout(() => reject(new Error('Ошибка вот тута')), 1000);
  
});

promise
	.then((result) => console.log(result))
  .then(() => console.log(promise))
  .catch(() => {
  	console.log('Сась, попенисье бросает ошибку!');
    throw new Error("Мась попик");
  })
  .catch((error) => console.log(error))
  
  
/* fetch('/article/promise-chaining/user.json')
  .then((response) => {return response.text})
  .then((text) => console.log(text))
  .catch((error) => console.log(error.message))
  .catch(() => console.log('Сась, попенисье!')) */