Fix poor man's async to break on and report errors
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user