1
0
mirror of http://git.whoc.org.uk/git/password-manager.git synced 2024-11-14 18:59:03 +01:00

Improved Async logging in case of deferred being cancelled

This commit is contained in:
Giulio Cesare Solaroli 2014-08-04 18:35:32 +02:00
parent a362a03cbe
commit 51e2e19014

View File

@ -61,13 +61,18 @@ Clipperz.Base.extend(Clipperz.Async.Deferred, MochiKit.Async.Deferred, {
} }
if (this.chained == false) { if (this.chained == false) {
var deferredName = this._name;
this.addErrback(function(aResult) {
var message; var message;
message = "ERROR [" + this._name + "]";
this.addErrback(function(aResult) {
if (! (aResult instanceof MochiKit.Async.CancelledError)) { if (! (aResult instanceof MochiKit.Async.CancelledError)) {
Clipperz.log(message, aResult); message = "ERROR [" + deferredName + "]";
} else {
message = "CANCELLED - " + deferredName;
} }
Clipperz.log(message, aResult);
return aResult; return aResult;
}); });
@ -101,7 +106,7 @@ Clipperz.Base.extend(Clipperz.Async.Deferred, MochiKit.Async.Deferred, {
// this.addBoth(function(aResult) {Clipperz.log(message + "-->", aResult); return aResult;}); // this.addBoth(function(aResult) {Clipperz.log(message + "-->", aResult); return aResult;});
this.addCallbacks( this.addCallbacks(
function(aResult) {Clipperz.log("-OK- " + message + "-->"/*, aResult*/); return aResult;}, function(aResult) {Clipperz.log("-OK- " + message + "-->"/*, aResult*/); return aResult;},
function(aResult) {Clipperz.log("FAIL " + message + "-->"/*, aResult*/); return aResult;} function(aResult) {if (! (aResult instanceof MochiKit.Async.CancelledError)) { Clipperz.log("FAIL " + message + "-->"/*, aResult*/);}; return aResult;}
); );
} }
@ -111,7 +116,7 @@ Clipperz.Base.extend(Clipperz.Async.Deferred, MochiKit.Async.Deferred, {
// this.addBoth(function(aResult) {Clipperz.log(message + "<--", aResult); return aResult;}); // this.addBoth(function(aResult) {Clipperz.log(message + "<--", aResult); return aResult;});
this.addCallbacks( this.addCallbacks(
function(aResult) {Clipperz.log("-OK- " + message + "<--", aResult); return aResult;}, function(aResult) {Clipperz.log("-OK- " + message + "<--", aResult); return aResult;},
function(aResult) {Clipperz.log("FAIL " + message + "<--", aResult); return aResult;} function(aResult) {if (! (aResult instanceof MochiKit.Async.CancelledError)) { Clipperz.log("FAIL " + message + "<--", aResult);}; return aResult;}
); );
} }
}, },