Fix poor man's async to break on and report errors

This commit is contained in:
Johannes Zellner
2018-03-27 19:38:09 +02:00
parent 977e83cc22
commit fd609d3e19

View File

@@ -9,7 +9,8 @@ function asyncForEach(items, handler, callback) {
if (items.length === 0) return callback();
(function iterator() {
handler(items[cur], function () {
handler(items[cur], function (error) {
if (error) return callback(error);
if (cur >= items.length-1) return callback();
++cur;