diff options
author | U-Zyn Chua <chua@uzyn.com> | 2015-06-28 15:32:16 +0800 |
---|---|---|
committer | U-Zyn Chua <chua@uzyn.com> | 2015-06-28 15:32:16 +0800 |
commit | d599c38c9b0617395e526a9e36df3045a81fc262 (patch) | |
tree | a823996b094f20bde9449fbb585667e862627b6d | |
parent | 57649026fe339aea13ec8d9be110d885c630a7e3 (diff) | |
download | async-d599c38c9b0617395e526a9e36df3045a81fc262.tar.gz |
test callback is now in the form of (err, truth)
-rw-r--r-- | lib/async.js | 10 | ||||
-rwxr-xr-x | test/test-async.js | 4 |
2 files changed, 10 insertions, 4 deletions
diff --git a/lib/async.js b/lib/async.js index 9ada840..7154ca2 100644 --- a/lib/async.js +++ b/lib/async.js @@ -847,7 +847,10 @@ }; async.during = function (test, iterator, callback) { - test(function(truth) { + test(function(err, truth) { + if (err) { + return callback(err); + } if (truth) { iterator(function (err) { if (err) { @@ -868,7 +871,10 @@ return callback(err); } var args = _baseSlice(arguments, 1); - args.push(function (truth) { + args.push(function (err, truth) { + if (err) { + return callback(err); + } if (truth) { async.doDuring(iterator, test, callback); } diff --git a/test/test-async.js b/test/test-async.js index 5385b63..25e964e 100755 --- a/test/test-async.js +++ b/test/test-async.js @@ -2854,7 +2854,7 @@ exports['during'] = function (test) { async.during( function (cb) { call_order.push(['test', count]); - cb(count < 5); + cb(null, count < 5); }, function (cb) { call_order.push(['iterator', count]); @@ -2889,7 +2889,7 @@ exports['doDuring'] = function (test) { }, function (cb) { call_order.push(['test', count]); - cb(count < 5); + cb(null, count < 5); }, function (err) { test.ok(err === null, err + " passed instead of 'null'"); |