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

Already on GitHub? Sign in to your account

"err" should be null not undefined #98

Closed
ghost opened this Issue Feb 20, 2012 · 4 comments

Comments

Projects
None yet
4 participants
@ghost

ghost commented Feb 20, 2012

When there is no error the error passed to a callback should be null instead of undefined.

This makes it mimic node.js default behavior so we don't have to change our code.

A concrete example is parallel() that is passing undefined as first argument to the callback when there is no error.

agreed

yawnt pushed a commit to yawnt/async that referenced this issue Apr 26, 2012

yawnt pushed a commit to yawnt/async that referenced this issue Apr 26, 2012

caolan added a commit that referenced this issue May 24, 2012

@caolan caolan closed this Mar 28, 2014

Contributor

fritx commented Mar 31, 2014

@caolan Oops, seems it should be callback(null)? #476

Contributor

vvo commented Mar 31, 2014

@fritx agree, we should always get null if there is no error.

vvo added a commit to vvo/async that referenced this issue Mar 31, 2014

style(null): always send null as first argument if no error
Async made a change that switched errors to `undefined` instead of null.

First async was all `callback(null)`, see #98, then it was all
`callback()`, see #476.

The change was worth 9 bytes of gzipped JavaScript, so this is not a
good argument on a 3kb+ gzipped lib.

The accepted callback-way is to have err === null if no error.

Maybe you won't be happy with the change but still I made it to see if
you agree or not.

+ updated tests
Contributor

fritx commented Apr 1, 2014

@vvo agreed..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment