Agreed, sometimes a yes or no question is answered by an error or success in a callback in node. You don't see this in blocking systems as much because try/catch is cumbersome but it's fairly common in node.
On Feb 25, 2013, at February 25, 201311:51 AM, Glenn Block <[email protected]> wrote: > "Normally you don't want go further when error is happened." > > In this case it is acceptable to continue processing as long as you capture > the received errors. If there were a high amt of failures you "might" > consider cancelling though. > > > On Mon, Feb 25, 2013 at 6:00 AM, Oleg Slobodskoi <[email protected]> > wrote: > I wrote this to handle such stuff: > > https://github.com/kof/do > > > Possibly I have to add a complete callback for the case one want to when it > is finished and than get the array of errors. > > Normally you don't want go further when error is happened. > > > Am 25.02.2013 um 10:57 schrieb Glenn Block <[email protected]>: > >> Hello all >> >> Let's assume you have an API that results in a batch of HTTP calls which >> fire async and which are not sequential. A constraint of the API is that any >> errors that occur during the calls need to get returned to the user. >> >> How have you customarily designed this? >> >> One idea was something like the following >> >> function send(message, callback) { >> } >> >> where callback is function(error, results) { >> } >> >> In this case error if not null is a JSON object with a collection of child >> objects with the errors. >> >> An alternative idea I had was to have an additional completion callback per >> item. >> >> so: >> >> function send(message, completionCallback, itemCallback) { >> } >> >> This introduces a callback for each item that is processed. In this case the >> completion callback has a single error if ANY errors occur while the >> itemCallback has individual errors as they occur. >> >> This is useful for cases where you might want to stop further processing if >> the number of errors is very high. >> >> Thoughts / Experiences? >> Glenn >> >> >> >> >> -- >> -- >> 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 >> >> --- >> 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 [email protected]. >> For more options, visit https://groups.google.com/groups/opt_out. >> >> > > > -- > -- > 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 > > --- > 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 [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > > > > > -- > -- > 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 > > --- > 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 [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > > -- -- 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 --- 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 [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
