You definitely should report with one error object, and you won't find 
function in Node.js API that returns more than one error.

Most straightforward way would be to fail your function as soon as first 
error occurs, and report with that error. However if you'd like to have 
more complete solution, that tries to delete all files and collects error 
information on the way, then you may want to report all approached errors 
on one error object. You can do it either via error.message or via other 
custom property on error object.


On Thursday, July 5, 2012 5:44:45 PM UTC+2, Alan Gutierrez wrote:
>
> Let's say that somewhere within your library, you delete the contents of a 
> directory in parallel. Let's say all the files in a  directory are 
> read-only so 
> all your parallel requests return an error. 
>
> If you've exposed a Node.js style asynchronous function with an `(error, 
> result, 
> result...)` callback, how do you report multiple errors to person who 
> called 
> your library? Do you wrap the multiple errors in a single error, maybe 
> having an 
> array of `causes`? Do you note that multiple errors may be returned? 
>
> Are the functions in the Node.js API that might return more than one error 
> that 
> I could study? Do any of the event emitters in the Node.js API emit a 
> series of 
> errors, or is it just one error prior to entering an error state? 
>
> -- 
> Alan Gutierrez - http://twitter.com/bigeasy - http://github.com/bigeasy 
>

-- 
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