Hi,

I'm curious about the effect of the following code:

  var d  = new Deferred();
  d.addCallback(function() { alert('f');  throw new
GenericError('foo'); });
  d.addErrback(function() { alert('e'); });
  d.addCallback(function() { alert('s'); });
  d.callback('success');

The result I observe is that all three alerts fire, in the order 'f',
'e', 's'.  This happens even though the first callback (f) throws an
exception.  My question is why is the last alert fired?

The docs say that a callback that throws an exception will put the
deferred into an error state.  Since the deferred transitions to an
error state, why does it continue calling the 'success' chain?

Is there a simple way to abort the callback chain from one of the
callbacks?

Many thanks!

Simon.

PS:  I'm using MochiKit from svn at about 4 months ago, so apologies
if this is not reproducible in the current version!

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"MochiKit" group.
To post to this group, send email to mochikit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/mochikit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to