If the chain of promises:
Promise(function(resolve, reject) {...})) .then(function() {return [ΠΠΎΠ²ΡΠΉ ΠΏΡΠΎΠΈΠΌΡ]}) .then(function() {return [ΠΠΎΠ²ΡΠΉ ΠΏΡΠΎΠΈΠΌΡ]}) .then(function() {return [ΠΠΎΠ²ΡΠΉ ΠΏΡΠΎΠΈΠΌΡ]}) ΠΈ Ρ.Π΄. You need to be able to interrupt it and, for example, start the function that creates the promise again, or any other preceding it does not matter. I do not use reject yet, in case of error I do resolve (0). Yes, and reject does not solve the problem:
Promise(function(resolve, reject) {reject();})) .then(function() {return [ΠΠΎΠ²ΡΠΉ ΠΏΡΠΎΠΈΠΌΡ]}, function() {[ΠΡΠΈΠ±ΠΊΠ°]}) // ΠΠ΄Π΅ΡΡ ΠΌΠΎΠΆΠ½ΠΎ ΠΎΠ±ΡΠ°Π±ΠΎΡΠ°ΡΡ ΠΎΡΠΈΠ±ΠΊΡ .then(function() {return [ΠΠΎΠ²ΡΠΉ ΠΏΡΠΎΠΈΠΌΡ]}) // ΠΠΎΠ΄ ΠΏΡΠΎΠ΄ΠΎΠ»ΠΆΠΈΡ Π²ΡΠΏΠΎΠ»Π½Π΅Π½ΠΈΠ΅ Π² Π»ΡΠ±ΠΎΠΌ ΡΠ»ΡΡΠ°Π΅ So far I see only this solution: in case of an error, do resolve (0) and at every stage do a check, pushing the error to the end:
.then(function(rez) { if(!rez) {[ΠΠ°ΠΏΡΡΠΊ Π€ΡΠ½ΠΊΡΠΈΠΈ ΠΡΠΈ ΠΡΠΈΠ±ΠΊΠ΅]; return rez;} else {return [ΠΠΎΠ²ΡΠΉ ΠΏΡΠΎΠΈΠΌΡ]} }) .then(function(rez) { if(!rez) {[ΠΠ°ΠΏΡΡΠΊ Π€ΡΠ½ΠΊΡΠΈΠΈ ΠΡΠΈ ΠΡΠΈΠ±ΠΊΠ΅]; return rez;} else {return [ΠΠΎΠ²ΡΠΉ ΠΏΡΠΎΠΈΠΌΡ]} }) But this is an extra code. How to make the next .then just not work?