Skip to content

Instantly share code, notes, and snippets.

@hjanuschka
Created September 1, 2016 06:40
Show Gist options
  • Save hjanuschka/a5dfc7b8bf0054a6e3afa3e332e0ca68 to your computer and use it in GitHub Desktop.
Save hjanuschka/a5dfc7b8bf0054a6e3afa3e332e0ca68 to your computer and use it in GitHub Desktop.
Promise.resolve()
.then(a)
.then(b)
.then(c)
.then(d)
.then(e)
.then(f)
.then(function() {
console.log("FINAL")
})
.catch(function(e) {
console.log("ERROR: " + e);
});
function a() {
console.log("a");
return Promise.resolve();
}
function b() {
console.log("b")
return Promise.resolve();
}
function c() {
console.log("c");
//I want to skip all steps till "FINAL"
return Promise.reject();
}
function d() {
console.log("d");
return Promise.resolve();
}
function e() {
console.log("e");
return Promise.resolve();
}
function f() {
console.log("f");
return Promise.resolve();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment