async.each not iterating when using promises

后端 未结 2 1691
执笔经年
执笔经年 2020-12-12 05:27

I am trying to run an asynchronous loop async.each over an array of objects. On each object in the array, I am trying to run two functions sequentially (using

2条回答
  •  渐次进展
    2020-12-12 06:22

    You are only using .then() callbacks so you handle success.

    But you should also add some .catch() callbacks to handle errors.

    Most likely you get errors that are not handled and nothing happens.

    For example:

                // ...
            }).then( function(result) {
                console.log("here");
                callback();
            }).catch(function (error) {
                console.log('Error:', error);
                callback(error);
            });
    

提交回复
热议问题