diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/internal/eachOfLimit.js | 5 | ||||
-rw-r--r-- | lib/internal/queue.js | 2 |
2 files changed, 5 insertions, 2 deletions
diff --git a/lib/internal/eachOfLimit.js b/lib/internal/eachOfLimit.js index ae153b1..2928366 100644 --- a/lib/internal/eachOfLimit.js +++ b/lib/internal/eachOfLimit.js @@ -9,7 +9,10 @@ import breakLoop from './breakLoop'; export default function _eachOfLimit(limit) { return function (obj, iteratee, callback) { callback = once(callback || noop); - if (limit <= 0 || !obj) { + if (limit <= 0) { + throw new RangeError('concurrency limit cannot be less than 1') + } + if (!obj) { return callback(null); } var nextElem = iterator(obj); diff --git a/lib/internal/queue.js b/lib/internal/queue.js index 575497b..a421d2e 100644 --- a/lib/internal/queue.js +++ b/lib/internal/queue.js @@ -9,7 +9,7 @@ export default function queue(worker, concurrency, payload) { concurrency = 1; } else if(concurrency === 0) { - throw new Error('Concurrency must not be zero'); + throw new RangeError('Concurrency must not be zero'); } var _worker = wrapAsync(worker); |