It's not just error handler, it should always be called at the end
once result is available and all callbacks/errback (including default
errback) are fired.
setFinalizer: function(cb) {
this._finalizer = cb;
}
if (this.chain.length == 0 && this._finalizer) {
this.finalized = true;
th
You mean like this?
setFinalizer: function(cb) {
this._finalizer = cb;
}
...
if (this.chain.length == 0 && this._finalizer) {
this.finalized = true;
if (res instanceof Error) {
this._finalizer(res);
}
}
Would that be acceptable to
Per,
Your hack won't work with my case as it would mark the deferred as
`chained` so consecutive addCallback/addErrback won't work. Considering
Bob's suggestion, I modified my patch to ensure no further
callback/errbacks can be registered.
Regards
--
Amit
Bob Ippolito wrote:
> Finalizing a Defer
Finalizing a Deferred should ensure that no further callback/errbacks
are registered and it should attach a default error handler (success
should be no-op). The most common problem I've seen with Deferreds is
that an error occurs but nobody attached an error handler that far
down the stack. In Pyt
I think this is a good idea. I needed something similar too, so I
ended up writing an ugly hack that worked most of the time...
d.addBoth(function (res) {d.addBoth(finalFunc); return res; });
It adds new callback once the first deferred result drops in,
hopefully after all the other callback
Hi Per,
I have just started again improving the MochiKit Extensions. While
creating tests for the Ajax module, I found one problem (not bug, but
specific to the feature I'm trying to implement). I registered a
callback which should be fired at the end of all registered callbacks.
I achieved by mo