JSFiddle - React, Tailwind, and code Playground
by jfriend00
HTML
<script src="http://files.the-friend-family.com/log.js"></script>
JavaScript
function promiseConstructorExample(){
return new Promise(function (resolve, reject){
// this exception is automatically turned into a promise rejection
throw "error";
});
}
promiseConstructorExample().then(function() {
log("success");
}, function(err) {
// exception throw in new Promise callback is caught here
log(err);
});