You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
When using async.series with callback(false) in a task function, the series is silently canceled without running the final callback. This behavior is unexpected and undocumented, as standard error handling in async.js should still invoke the final callback when an error occurs.
Expected Behavior
When callback(false) is called in a task function:
Remaining task functions should be skipped (which happens correctly)
The final callback should still be executed with the error value (which doesn't happen)
OR
Should be treated like null and continue to the next task
Expected output: 1 3 or 1 2 3
Actual Behavior
Only 1 is printed. The final callback is never invoked and the series is silently canceled.
This is expected behavior, and is called out on the first page of the drugs under the common pitfalls section under "subtle memory leaks" as a way to cancel a flow. Maybe it should be more prominent.
Standard convention is to return null for the first callback argument. ( Or use async/await, async.series feels a bit obsolete these days )
Description
When using async.series with callback(false) in a task function, the series is silently canceled without running the final callback. This behavior is unexpected and undocumented, as standard error handling in async.js should still invoke the final callback when an error occurs.
Code to Reproduce
Expected Behavior
When callback(false) is called in a task function:
Remaining task functions should be skipped (which happens correctly)
The final callback should still be executed with the error value (which doesn't happen)
OR
Should be treated like null and continue to the next task
Expected output: 1 3 or 1 2 3
Actual Behavior
Only 1 is printed. The final callback is never invoked and the series is silently canceled.
Version Information
async.js version: [email protected]
Node.js version: v18.20.4
Platform: macOS - 15.3.2 - 24D81
The text was updated successfully, but these errors were encountered: