Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

async queue example should show how to handle errors #1539

Closed
ORESoftware opened this issue Jun 3, 2018 · 4 comments
Closed

async queue example should show how to handle errors #1539

ORESoftware opened this issue Jun 3, 2018 · 4 comments
Labels

Comments

@ORESoftware
Copy link
Contributor

ORESoftware commented Jun 3, 2018

Looking at the docs for async.queue
https://caolan.github.io/async/docs.html#queue

// create a queue object with concurrency 2
var q = async.queue(function(task, callback) {
    console.log('hello ' + task.name);
    callback();
}, 2);

// assign a callback
q.drain = function() {
    console.log('all items have been processed');
};

is there an

q.onError = function(err){

}

handler that we can use?

I don't think q.drain is an error-first callback, and I don't want to pass a callback for each q.push or q.unshift call, I just want to use one error-first callback.

This should exist and be in the docs, right?

@aearly aearly added the question label Jun 3, 2018
@aearly
Copy link
Collaborator

aearly commented Jun 3, 2018

https://caolan.github.io/async/docs.html#QueueObject

q.error exists, and there is an optional callback you can pass to q.push().

@aearly aearly closed this as completed Jun 3, 2018
@ORESoftware
Copy link
Contributor Author

@aearly it needs to be documented in the example, that is the bug. How can I add it to the example? How do I make a PR for the docs?

@aearly
Copy link
Collaborator

aearly commented Jun 3, 2018

The example is in the JSDoc comment in the queue source.

@ORESoftware
Copy link
Contributor Author

#1540

sounds good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants