How would you make a call to the next error function with promise chaining?
I thought a return inside the error function would automatically call the next error function.
//Called in a controller
dataService.saveRequest()
.then(function result(res){
//Logged when the service sends back a result
console.log("finished");
}, function error(error){
//Logged when the service sends back an error
//THIS DOES NOT GET CALLED
console.log("error from controller");
});
//INSIDE THE SERVICE
this.saveRequest = function(){
return $http.post('rest/request/send-request', someData)
.then(function(result){
//Goes, as expected, into the success function in the controller
return result.data;
}, function(error){
//Does NOT go into the next error function
//I need the error function to execute in the controller
return error;
});
};