I'm facing an issue in regards to error handling with Promise.all
I would expect the following code to call the catch part of the chain when one of the getNetworkstuff()
Promises fails. But instead it just calls the next then part and the Browser Console shows an uncaught Error.
Promise.all(
[[getNetworkstuff(url1)],[getNetworkstuff(url2)]]
//please note that the arrays within the array are larger in my application
//otherwise I would just use one big array not arrays in arrays
)
.then(function(result){//Stuff worked})
.catch(function(err){//Stuff broke});
function getNetworkstuff(url){
return new Promise(function(resolve,reject){//here will be awesome network code})
}
I can see that the promise has not fulfilled as the returned result
array contains the appropriate rejected promise.
[[PromiseStatus]]: "rejected"
[[PromiseValue]]: Error: HTTP GET resulted in HTTP status code 404.
Can somebody tell me why catch
is not called? (I know it is if I just have an Array of Promises in Promise.all()
of which one rejects)