I believe a streaming API would be more appropriate for such a task. Something like:

var deleter = new Deleter('~');

deleter.on('error', function (err) {
  console.error(err)
})

deleter.on('file', function (fileName) {
  console.log('deleted ' + fileName)
})

deleter.on('end', function () {
  console.log('done!');
})

On 07/05/2012 06:44 PM, 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 nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to