Created
March 8, 2018 02:48
-
-
Save dbuduev/4369e686414a51e3ed55c1b3e1a503c9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let rootPromise = new Promise((resolve, reject) => reject('Bad promise')); | |
rootPromise | |
.then(_ => { | |
console.log("Promise resolved"); | |
return Promise.resolve(30); | |
}, error => { | |
console.log("Error", error); | |
// return Promise.resolve(55); // prints Result 55 | |
return Promise.reject(44); // prints Catch 44 | |
// throw new Error("exception"); // prints Catch exception | |
}) | |
.then(result => { | |
console.log("Result", result); | |
return Promise.resolve(); | |
}) | |
.catch(error => { | |
console.log("Catch", error.message || error); | |
console.log("----"); | |
return Promise.resolve(); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment