[Dojo-interest] How to debug "This deferred has already been resolved" errors

107 views
Skip to first unread message

Jean-Pierre Bergamin

unread,
Mar 14, 2012, 5:15:23 PM3/14/12
to dojo-i...@mail.dojotoolkit.org
Hello dojo users

I'm always having a hard time to debug programmatic errors in deferred functions. Let's have a look at an example, where myPane is a ContentPane:

myPane.set("onDownloadError", function(err) {
    var myNull;
    myNull.get("foo");
    return err.message;
});
myPane.set("href", "some/url");

There is a bad bug in the "onDownloadError" function. In the console I see:
8<------------------------------------------------------------------- 
Error
arguments: undefined
get stack: function getter() { [native code] }
message: "This deferred has already been resolved"
set stack: function setter() { [native code] }
type: undefined
__proto__: ErrorPrototype

    dojo.Deferred.reject.errback    Deferred.js:216
    dojo.Deferred.reject.errback    Deferred.js:216
    notify    Deferred.js:186
    complete  Deferred.js:162
    dojo.Deferred.reject.errback    Deferred.js:213
    notify   Deferred.js:186
    complete    Deferred.js:162
    dojo.Deferred.resolve.callback    Deferred.js:203
    notify   Deferred.js:184
    complete   Deferred.js:162
    dojo.Deferred.resolve.callback    Deferred.js:203
    _resHandle    xhr.js:620
    func    xhr.js:506
    _watchInFlight    xhr.js:525
8<-------------------------------------------------------------------

There is no actual trace to the function that cause this error.

How do I actually find out that this error comes from the onDownloadError handler? What's a good way to debug such errors?


Best regards,
James
Reply all
Reply to author
Forward
0 new messages