Created
February 2, 2016 03:31
-
-
Save Azerothian/ea17f5fde1467c08410b to your computer and use it in GitHub Desktop.
This file contains hidden or 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
function rejectOn4(v) { | |
if (v === 4) { | |
throw "crash"; | |
} | |
} | |
function increment(v){ | |
return v++; | |
} | |
function chain(v) { | |
return Promise.resolve(v) | |
.then(increment) | |
.then(rejectOn4); | |
} | |
Promise.resolve(1) | |
.then(chain) | |
.then(chain) | |
.then(chain) | |
.then(chain) | |
.then(chain) | |
.then(chain) | |
.then(() => { | |
console.log("success"); | |
}, (err) => { | |
console.log("deal with it") | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment