Owen,

I could be wrong, but I think your question stems from the "only use 
exceptions for exceptional things" philosophy. This philosophy is partly 
due to performance considerations 
<http://blog.codinghorror.com/creating-more-exceptional-exceptions/> and mostly 
from the way exceptions bubble 
<http://stackoverflow.com/questions/180937/are-exceptions-really-for-exceptional-errors>
 
and interrupt the sequential execution of the code.

Neither of these considerations apply in languages like C and Go, which do 
not have exceptions (in the C++ and Javascript sense). Node's async error 
handling convention (an optional error object that doesn't bubble & must be 
explicitly passed) has more in common with C and Go than with 
C++/Javascript exceptions.

IOW, passing a null error and putting an error code or an object with 
*{success: 
false}* in the result is a workaround for a problem that doesn't exist with 
Node's async error handling. IMO it's better to put the error where it 
belongs, in the first argument to the callback, unless the code in question 
doesn't know it's an error b/c the code is operating at a lower layer and 
just passing on the information received from the server, as Aria pointed 
out, and a higher layer needs to interpret the information and decide 
whether it's an error.

-- peter

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
To post to this group, send email to nodejs@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/c4307787-0225-463d-8e59-ba5ca6de6e7a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to