JSFiddle - React, Tailwind, and code Playground

by Abdul Ahmad

JavaScript

function async() {
	return Promise.resolve({ status: 'success' });
}

function async2() {
	return async().then(r => {
    if (r.status === 'error') throw r;
    return;
  });
}

async2().then(r => {
	console.log('success', r);
}).catch(e => {
	console.log('error', e);
});