Im new to js and getting hard time understanding the promises, and nested promises. why is it that when my promise return an error, it still load the nested .then(). here is my sample code.
firstFunction()
.then(success(){
//some statement
return secondFunction();
}, error(err){
//logging the err.
})
.then(success(){
//some statement for secondFunction
},error(err){
//logging error for second function
})
when my firstFunction is okay, they work fine, load firstfunction .then, followed by secondFunction.then, but when first function fails, it goes to its :error(err) function, but still executes my code in my secondFunction.then() ?