dimanche 30 novembre 2014

Stopping JavaScript Promises From Propogating


Imagine I have a promise chain like the one below. If func2 is called, I would like to avoid func3 or func4 from being called altogether.



AsyncFunction()
.then(func1, func2)
.then(func3, func4)


At the moment, If I throw an error in func2, func4 would be called. If I return a value in func2, func3 seems to be called.


I am using Angular $q.





Aucun commentaire:

Enregistrer un commentaire