Created
April 22, 2017 19:37
-
-
Save alacambra/07fae6718bd0221e6c65704a739987a0 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
new Promise(function (resolve, reject) { | |
resolve("my data"); | |
reject("my error"); | |
}) | |
.then((data) => ho(data, 1) | |
// , err => { | |
// he(err, 1); | |
// return Promise.reject(err) | |
// } | |
) | |
.then((data) => ho(data, 2) | |
// , err => he(err, 2) | |
) | |
.then((data) => ho(data, 3) | |
// , err => he(err, 3) | |
, err => Promise.reject(err + " on 3") | |
) | |
.then((data) => ho(data, 4) | |
// , err => he(err, 4) | |
) | |
.catch(thr => console.info("catched....", thr)) | |
; | |
function he(err, i) { | |
console.info("handle error: " + i, err); | |
return err + i; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment