Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

"err" should be null not undefined #98

Closed
ghost opened this Issue · 4 comments

4 participants

@ghost

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.

@jpstrikesback

agreed

@yawnt yawnt referenced this issue from a commit in yawnt/async
@tiankongldp tiankongldp fix issue #98 b4e5427
@yawnt yawnt referenced this issue from a commit in yawnt/async
@tiankongldp tiankongldp moar fixes for #98 639fb49
@caolan caolan closed this
@fritx

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

@vvo

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

@vvo vvo referenced this issue from a commit in vvo/async
@vvo vvo 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
1ef2b84
@fritx

@vvo agreed..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.