It should be null or undefined only, everything else is a value, and can 
mistakenly accepted as an error.

There are however asynchronous functions that never resolve with an error 
(e.g. path.exists) and as there's no point in always sending null to their 
callbacks, they're designed to pass success value as first argument (in 
case of path.exists true or false).

-- 
Mariusz Nowak - @medikoo


On Wednesday, May 30, 2012 3:24:06 AM UTC+2, Daniel R. wrote:
>
> Is there consensus on the value to pass to a callback if there isn't 
> an error and there may or may not be a resulting value. A quick survey 
> of node.js code along with popular modules seems to indicate that null 
> is most common but undefined and false also pop up frequently. While 
> any falsey value works I was curious if one was preferred. 
>
> -- Daniel R. <[email protected]> [http://danielr.neophi.com/] 
>

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to