3 ms·
The error that is thrown towards the end of this example should probably be passed back to the callback as an argument (e.g. callback(error, result)) instead.
by tg3 14y ago
The error that is thrown towards the end of this example should probably be passed back to the callback as an argument (e.g. callback(error, result)) instead.
Throwing errors in an asynchronous context can have messy results for trying to handle them. http://benno.id.au/blog/2011/08/08/nodejs-exceptions http://benno.id.au/blog/2011/08/08/nodejs-exceptions is a good explanation.
- c_t_montgomery 14y agoGreat point. I'll update the gist. Thanks for bringing this up!