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.waterfall breaks when given an async function (node 8) #1480
Comments
Callbacks are not passed to |
In the case of the first function above, where more than one argument is passed to |
Yeah, you could do something like: async.waterfall([
// ...
async function (arg1, arg2) {
//...
const arg3 = await foo()
return [arg1, arg2, arg3]
},
function ([arg1, arg2, arg3], callback) {
//...
} |
Then how to return error? Just using throw? |
Any answers to the above question? I believe to bail when encountered an error in a async function , you still need to call the "next" callback |
How about this? async.waterfall([
// ...
async function (arg1, arg2, callback) {
//...
try {
const arg3 = await foo()
return [arg1, arg2, arg3]
} catch (err) {
callback('An error occured:' + err.message);
}
},
function ([arg1, arg2, arg3], callback) {
//...
} |
|
Thanks. |
IIFE can be helpful here.
|
This wont do what you expect. The |
a |
b |
c |
What version of async are you using?
2.5.0
Which environment did the issue occur in (Node version/browser version)
Node 8
What did you do? Please include a minimal reproducable case illustrating issue.
What did you expect to happen?
to not have an exception
What was the actual result?
The text was updated successfully, but these errors were encountered: