Hacker News new | ask | show | jobs
by laggyluke 4029 days ago
You might want to reconsider your Node.js callback API. The standard way of returning errors is via the first argument :

    callback(err, data)
while you suggest doing it like this:

    callback(data, err)
Apart from being an eyesore, it breaks compatibility with a ton of third-party libs like `caolan/async`.
2 comments

Hi laggyluke, thanks for your comment. I'll check with a few developers I know - most of what I've seen has been the reverse but I'm not in node on a daily basis. Cheers
Just check the node docs.
Got it, changing now. Thanks
Thanks for the education laggyluke, much appreciated