diff options
author | Johan Nordberg <its@johan-nordberg.com> | 2016-05-29 12:06:57 +0200 |
---|---|---|
committer | Johan Nordberg <its@johan-nordberg.com> | 2016-05-29 12:06:57 +0200 |
commit | 0e56ab5c60012d86306f814394fa22ec4252b367 (patch) | |
tree | 6ec91c5fe2e42f2ce36fa1fe0ade150c81ff3b54 | |
parent | af6c5956da1d98855a63d34e9c7aa3bb90b4140d (diff) | |
download | async-0e56ab5c60012d86306f814394fa22ec4252b367.tar.gz |
Add queue.error handler.
With the signature `function(error, task){}`
-rw-r--r-- | lib/internal/queue.js | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/internal/queue.js b/lib/internal/queue.js index 9a1f77f..544fae5 100644 --- a/lib/internal/queue.js +++ b/lib/internal/queue.js @@ -61,6 +61,10 @@ export default function queue(worker, concurrency, payload) { }); task.callback.apply(task, args); + + if (args[0] != null) { + q.error(args[0], task.data); + } }); if (workers <= (q.concurrency - q.buffer) ) { @@ -85,6 +89,7 @@ export default function queue(worker, concurrency, payload) { buffer: concurrency / 4, empty: noop, drain: noop, + error: noop, started: false, paused: false, push: function (data, callback) { |