summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-10-24 14:13:44 +0200
committerwolfbeast <mcwerewolf@gmail.com>2018-10-24 14:13:44 +0200
commit768a1b94576f6a9da284fdb69b9fb1d3354c8f5d (patch)
treed6509c2c36084799a546257d0b8946014eb49e13
parent26412bcab4723d44bc0eb22d7c858e85a84910d5 (diff)
downloadUXP-768a1b94576f6a9da284fdb69b9fb1d3354c8f5d.tar
UXP-768a1b94576f6a9da284fdb69b9fb1d3354c8f5d.tar.gz
UXP-768a1b94576f6a9da284fdb69b9fb1d3354c8f5d.tar.lz
UXP-768a1b94576f6a9da284fdb69b9fb1d3354c8f5d.tar.xz
UXP-768a1b94576f6a9da284fdb69b9fb1d3354c8f5d.zip
Pass exceptions directly to logger.
-rw-r--r--services/sync/modules/addonsreconciler.js5
-rw-r--r--services/sync/modules/addonutils.js2
-rw-r--r--services/sync/modules/engines.js27
-rw-r--r--services/sync/modules/engines/bookmarks.js13
-rw-r--r--services/sync/modules/engines/passwords.js7
-rw-r--r--services/sync/modules/identity.js2
-rw-r--r--services/sync/modules/notifications.js2
-rw-r--r--services/sync/modules/policies.js2
-rw-r--r--services/sync/modules/record.js2
-rw-r--r--services/sync/modules/resource.js19
-rw-r--r--services/sync/modules/service.js22
-rw-r--r--services/sync/modules/stages/enginesync.js3
-rw-r--r--services/sync/modules/util.js2
13 files changed, 49 insertions, 59 deletions
diff --git a/services/sync/modules/addonsreconciler.js b/services/sync/modules/addonsreconciler.js
index 96752a511..ec0896bb2 100644
--- a/services/sync/modules/addonsreconciler.js
+++ b/services/sync/modules/addonsreconciler.js
@@ -488,8 +488,7 @@ AddonsReconciler.prototype = {
try {
listener.changeListener.call(listener, date, change, state);
} catch (ex) {
- this._log.warn("Exception calling change listener: " +
- Utils.exceptionStr(ex));
+ this._log.warn("Exception calling change listener: ", ex);
}
}
},
@@ -635,7 +634,7 @@ AddonsReconciler.prototype = {
}
}
catch (ex) {
- this._log.warn("Exception: " + Utils.exceptionStr(ex));
+ this._log.warn("Exception: ", ex);
}
},
diff --git a/services/sync/modules/addonutils.js b/services/sync/modules/addonutils.js
index 11b6b0397..3332f4cfc 100644
--- a/services/sync/modules/addonutils.js
+++ b/services/sync/modules/addonutils.js
@@ -164,7 +164,7 @@ AddonUtilsInternal.prototype = {
install.install();
}
catch (ex) {
- this._log.error("Error installing add-on: " + Utils.exceptionstr(ex));
+ this._log.error("Error installing add-on: ", ex);
cb(ex, null);
}
}.bind(this), options.requireSecureURI);
diff --git a/services/sync/modules/engines.js b/services/sync/modules/engines.js
index 8fce34ff7..4767a1103 100644
--- a/services/sync/modules/engines.js
+++ b/services/sync/modules/engines.js
@@ -310,7 +310,7 @@ Store.prototype = {
throw ex.cause;
} catch (ex) {
this._log.warn("Failed to apply incoming record " + record.id);
- this._log.warn("Encountered exception: " + Utils.exceptionStr(ex));
+ this._log.warn("Encountered exception: ", ex);
failed.push(record.id);
}
};
@@ -578,7 +578,7 @@ EngineManager.prototype = {
this._engines[name] = engine;
}
} catch (ex) {
- this._log.error(CommonUtils.exceptionStr(ex));
+ this._log.error("Engine init error: ", ex);
let mesg = ex.message ? ex.message : ex;
let name = engineObject || "";
@@ -793,7 +793,7 @@ SyncEngine.prototype = {
return this._toFetch;
},
set toFetch(val) {
- let cb = (error) => this._log.error(Utils.exceptionStr(error));
+ let cb = (error) => this._log.error("Failed to read JSON records to fetch: ", error);
// Coerce the array to a string for more efficient comparison.
if (val + "" == this._toFetch) {
return;
@@ -818,7 +818,13 @@ SyncEngine.prototype = {
return this._previousFailed;
},
set previousFailed(val) {
- let cb = (error) => this._log.error(Utils.exceptionStr(error));
+ let cb = (error) => {
+ if (error) {
+ this._log.error("Failed to set previousFailed", error);
+ } else {
+ this._log.debug("Successfully wrote previousFailed.");
+ }
+ }
// Coerce the array to a string for more efficient comparison.
if (val + "" == this._previousFailed) {
return;
@@ -1001,8 +1007,7 @@ SyncEngine.prototype = {
} catch (ex) {
// Catch any error that escapes from applyIncomingBatch. At present
// those will all be abort events.
- this._log.warn("Got exception " + Utils.exceptionStr(ex) +
- ", aborting processIncoming.");
+ this._log.warn("Got exception, aborting processIncoming. ", ex);
aborting = ex;
}
this._tracker.ignoreAll = false;
@@ -1070,7 +1075,7 @@ SyncEngine.prototype = {
self._log.debug("Ignoring second retry suggestion.");
// Fall through to error case.
case SyncEngine.kRecoveryStrategy.error:
- self._log.warn("Error decrypting record: " + Utils.exceptionStr(ex));
+ self._log.warn("Error decrypting record: ", ex);
failed.push(item.id);
return;
case SyncEngine.kRecoveryStrategy.ignore:
@@ -1080,7 +1085,7 @@ SyncEngine.prototype = {
}
}
} catch (ex) {
- self._log.warn("Error decrypting record: " + Utils.exceptionStr(ex));
+ self._log.warn("Error decrypting record: ", ex);
failed.push(item.id);
return;
}
@@ -1094,7 +1099,7 @@ SyncEngine.prototype = {
aborting = ex.cause;
} catch (ex) {
self._log.warn("Failed to reconcile incoming record " + item.id);
- self._log.warn("Encountered exception: " + Utils.exceptionStr(ex));
+ self._log.warn("Encountered exception: ", ex);
failed.push(item.id);
return;
}
@@ -1466,7 +1471,7 @@ SyncEngine.prototype = {
up.pushData(out);
}
catch(ex) {
- this._log.warn("Error creating record: " + Utils.exceptionStr(ex));
+ this._log.warn("Error creating record: ", ex);
}
// Partial upload
@@ -1558,7 +1563,7 @@ SyncEngine.prototype = {
test.get();
}
catch(ex) {
- this._log.debug("Failed test decrypt: " + Utils.exceptionStr(ex));
+ this._log.debug("Failed test decrypt: ", ex);
}
return canDecrypt;
diff --git a/services/sync/modules/engines/bookmarks.js b/services/sync/modules/engines/bookmarks.js
index 42d91f57e..41283c06d 100644
--- a/services/sync/modules/engines/bookmarks.js
+++ b/services/sync/modules/engines/bookmarks.js
@@ -373,8 +373,7 @@ BookmarksEngine.prototype = {
// Failure to create a backup is somewhat bad, but probably not bad
// enough to prevent syncing of bookmarks - so just log the error and
// continue.
- this._log.warn("Got exception \"" + Utils.exceptionStr(ex) +
- "\" backing up bookmarks, but continuing with sync.");
+ this._log.warn("Got exception backing up bookmarks, but continuing with sync.", ex);
cb();
}
);
@@ -389,9 +388,8 @@ BookmarksEngine.prototype = {
try {
guidMap = this._buildGUIDMap();
} catch (ex) {
- this._log.warn("Got exception \"" + Utils.exceptionStr(ex) +
- "\" building GUID map." +
- " Skipping all other incoming items.");
+ this._log.warn("Got exception building GUID map." +
+ " Skipping all other incoming items.", ex);
throw {code: Engine.prototype.eEngineAbortApplyIncoming,
cause: ex};
}
@@ -637,7 +635,7 @@ BookmarksStore.prototype = {
return true;
}
} catch(ex) {
- this._log.debug("Failed to reparent item. " + Utils.exceptionStr(ex));
+ this._log.debug("Failed to reparent item. ", ex);
}
return false;
},
@@ -1265,8 +1263,7 @@ BookmarksStore.prototype = {
let u = PlacesUtils.bookmarks.getBookmarkURI(itemID);
this._tagURI(u, tags);
} catch (e) {
- this._log.warn("Got exception fetching URI for " + itemID + ": not tagging. " +
- Utils.exceptionStr(e));
+ this._log.warn("Got exception fetching URI for " + itemID + ": not tagging. ", e);
// I guess it doesn't have a URI. Don't try to tag it.
return;
diff --git a/services/sync/modules/engines/passwords.js b/services/sync/modules/engines/passwords.js
index 2837b6a10..0ccd2e7b0 100644
--- a/services/sync/modules/engines/passwords.js
+++ b/services/sync/modules/engines/passwords.js
@@ -67,7 +67,7 @@ PasswordEngine.prototype = {
Svc.Prefs.set("deletePwdFxA", true);
Svc.Prefs.reset("deletePwd"); // The old prefname we previously used.
} catch (ex) {
- this._log.debug("Password deletes failed: " + Utils.exceptionStr(ex));
+ this._log.debug("Password deletes failed: ", ex);
}
}
},
@@ -213,7 +213,7 @@ PasswordStore.prototype = {
Services.logins.addLogin(login);
} catch(ex) {
this._log.debug("Adding record " + record.id +
- " resulted in exception " + Utils.exceptionStr(ex));
+ " resulted in exception ", ex);
}
},
@@ -246,8 +246,7 @@ PasswordStore.prototype = {
Services.logins.modifyLogin(loginItem, newinfo);
} catch(ex) {
this._log.debug("Modifying record " + record.id +
- " resulted in exception " + Utils.exceptionStr(ex) +
- ". Not modifying.");
+ " resulted in exception. Not modifying.", ex);
}
},
diff --git a/services/sync/modules/identity.js b/services/sync/modules/identity.js
index 624fad21c..f89ffca47 100644
--- a/services/sync/modules/identity.js
+++ b/services/sync/modules/identity.js
@@ -337,7 +337,7 @@ IdentityManager.prototype = {
try {
this._syncKeyBundle = new SyncKeyBundle(this.username, this.syncKey);
} catch (ex) {
- this._log.warn("Failed to create sync key bundle", Utils.exceptionStr(ex));
+ this._log.warn("Failed to create sync key bundle", ex);
return null;
}
}
diff --git a/services/sync/modules/notifications.js b/services/sync/modules/notifications.js
index 72187a4ce..5a67a7414 100644
--- a/services/sync/modules/notifications.js
+++ b/services/sync/modules/notifications.js
@@ -119,7 +119,7 @@ this.NotificationButton =
callback.apply(this, arguments);
} catch (e) {
let logger = Log.repository.getLogger("Sync.Notifications");
- logger.error("An exception occurred: " + Utils.exceptionStr(e));
+ logger.error("An exception occurred: ", e);
logger.info(Utils.stackTrace(e));
throw e;
}
diff --git a/services/sync/modules/policies.js b/services/sync/modules/policies.js
index 38f118d3f..7a6c70445 100644
--- a/services/sync/modules/policies.js
+++ b/services/sync/modules/policies.js
@@ -599,7 +599,7 @@ ErrorHandler.prototype = {
this.checkServerError(exception);
Status.engines = [engine_name, exception.failureCode || ENGINE_UNKNOWN_FAIL];
- this._log.debug(engine_name + " failed: " + Utils.exceptionStr(exception));
+ this._log.debug(engine_name + " failed: ", exception);
break;
case "weave:service:login:error":
this.resetFileLog(this._logManager.REASON_ERROR);
diff --git a/services/sync/modules/record.js b/services/sync/modules/record.js
index e609ad1bc..5dc1c012c 100644
--- a/services/sync/modules/record.js
+++ b/services/sync/modules/record.js
@@ -236,7 +236,7 @@ RecordManager.prototype = {
return this.set(url, record);
} catch(ex) {
- this._log.debug("Failed to import record: " + Utils.exceptionStr(ex));
+ this._log.debug("Failed to import record: ", ex);
return null;
}
},
diff --git a/services/sync/modules/resource.js b/services/sync/modules/resource.js
index b31d129a5..a6c0739b6 100644
--- a/services/sync/modules/resource.js
+++ b/services/sync/modules/resource.js
@@ -231,7 +231,7 @@ AsyncResource.prototype = {
channel.asyncOpen(listener, null);
} catch (ex) {
// asyncOpen can throw in a bunch of cases -- e.g., a forbidden port.
- this._log.warn("Caught an error in asyncOpen: " + CommonUtils.exceptionStr(ex));
+ this._log.warn("Caught an error in asyncOpen: ", ex);
CommonUtils.nextTick(callback.bind(this, ex));
}
},
@@ -278,8 +278,7 @@ AsyncResource.prototype = {
} catch(ex) {
// Got a response, but an exception occurred during processing.
// This shouldn't occur.
- this._log.warn("Caught unexpected exception " + CommonUtils.exceptionStr(ex) +
- " in _onComplete.");
+ this._log.warn("Caught unexpected exception in _onComplete. ", ex);
this._log.debug(CommonUtils.stackTrace(ex));
}
@@ -318,8 +317,7 @@ AsyncResource.prototype = {
contentLength + ".");
}
} catch (ex) {
- this._log.debug("Caught exception " + CommonUtils.exceptionStr(ex) +
- " visiting headers in _onComplete.");
+ this._log.debug("Caught exception visiting headers in _onComplete", ex);
this._log.debug(CommonUtils.stackTrace(ex));
}
@@ -335,7 +333,7 @@ AsyncResource.prototype = {
try {
return JSON.parse(ret);
} catch (ex) {
- this._log.warn("Got exception parsing response body: \"" + CommonUtils.exceptionStr(ex));
+ this._log.warn("Got exception parsing response body", ex);
// Stringify to avoid possibly printing non-printable characters.
this._log.debug("Parse fail: Response body starts: \"" +
JSON.stringify((ret + "").slice(0, 100)) +
@@ -541,7 +539,7 @@ ChannelListener.prototype = {
siStream = Cc["@mozilla.org/scriptableinputstream;1"].createInstance(Ci.nsIScriptableInputStream);
siStream.init(stream);
} catch (ex) {
- this._log.warn("Exception creating nsIScriptableInputStream." + CommonUtils.exceptionStr(ex));
+ this._log.warn("Exception creating nsIScriptableInputStream", ex);
this._log.debug("Parameters: " + req.URI.spec + ", " + stream + ", " + off + ", " + count);
// Cannot proceed, so rethrow and allow the channel to cancel itself.
throw ex;
@@ -558,8 +556,7 @@ ChannelListener.prototype = {
this._onProgress();
} catch (ex) {
this._log.warn("Got exception calling onProgress handler during fetch of "
- + req.URI.spec);
- this._log.debug(CommonUtils.exceptionStr(ex));
+ + req.URI.spec, ex);
this._log.trace("Rethrowing; expect a failure code from the HTTP channel.");
throw ex;
}
@@ -574,7 +571,7 @@ ChannelListener.prototype = {
try {
CommonUtils.namedTimer(this.abortRequest, this._timeout, this, "abortTimer");
} catch (ex) {
- this._log.warn("Got exception extending abort timer: " + CommonUtils.exceptionStr(ex));
+ this._log.warn("Got exception extending abort timer: ", ex);
}
},
@@ -668,7 +665,7 @@ ChannelNotificationListener.prototype = {
}
}
} catch (ex) {
- this._log.error("Error copying headers: " + CommonUtils.exceptionStr(ex));
+ this._log.error("Error copying headers: ", ex);
}
// We let all redirects proceed.
diff --git a/services/sync/modules/service.js b/services/sync/modules/service.js
index 2631efafd..d3fb6c864 100644
--- a/services/sync/modules/service.js
+++ b/services/sync/modules/service.js
@@ -465,8 +465,7 @@ Sync11Service.prototype = {
this.engineManager.register(ns[engineName]);
} catch (ex) {
- this._log.warn("Could not register engine " + name + ": " +
- CommonUtils.exceptionStr(ex));
+ this._log.warn("Could not register engine " + name + ": ", ex);
}
}
@@ -661,8 +660,7 @@ Sync11Service.prototype = {
} catch (ex) {
// This means no keys are present, or there's a network error.
- this._log.debug("Failed to fetch and verify keys: "
- + Utils.exceptionStr(ex));
+ this._log.debug("Failed to fetch and verify keys: ", ex);
this.errorHandler.checkServerError(ex);
return false;
}
@@ -759,7 +757,7 @@ Sync11Service.prototype = {
}
} catch (ex) {
// Must have failed on some network issue
- this._log.debug("verifyLogin failed: " + Utils.exceptionStr(ex));
+ this._log.debug("verifyLogin failed: ", ex);
this.status.login = LOGIN_FAILED_NETWORK_ERROR;
this.errorHandler.checkServerError(ex);
return false;
@@ -832,8 +830,7 @@ Sync11Service.prototype = {
try {
cb.wait();
} catch (ex) {
- this._log.debug("Password change failed: " +
- CommonUtils.exceptionStr(ex));
+ this._log.debug("Password change failed: ", ex);
return false;
}
@@ -879,8 +876,7 @@ Sync11Service.prototype = {
try {
engine.removeClientData();
} catch(ex) {
- this._log.warn("Deleting client data for " + engine.name + " failed:"
- + Utils.exceptionStr(ex));
+ this._log.warn("Deleting client data for " + engine.name + " failed:", ex);
}
}
this._log.debug("Finished deleting client data.");
@@ -1508,7 +1504,7 @@ Sync11Service.prototype = {
try {
response = res.delete();
} catch (ex) {
- this._log.debug("Failed to wipe server: " + CommonUtils.exceptionStr(ex));
+ this._log.debug("Failed to wipe server: ", ex);
throw ex;
}
if (response.status != 200 && response.status != 404) {
@@ -1525,8 +1521,7 @@ Sync11Service.prototype = {
try {
response = this.resource(url).delete();
} catch (ex) {
- this._log.debug("Failed to wipe '" + name + "' collection: " +
- Utils.exceptionStr(ex));
+ this._log.debug("Failed to wipe '" + name + "' collection: ", ex);
throw ex;
}
@@ -1672,8 +1667,7 @@ Sync11Service.prototype = {
return this.getStorageRequest(url).get(function onComplete(error) {
// Note: 'this' is the request.
if (error) {
- this._log.debug("Failed to retrieve '" + info_type + "': " +
- Utils.exceptionStr(error));
+ this._log.debug("Failed to retrieve '" + info_type + "': ", error);
return callback(error);
}
if (this.response.status != 200) {
diff --git a/services/sync/modules/stages/enginesync.js b/services/sync/modules/stages/enginesync.js
index ce7fce94d..61f2005d8 100644
--- a/services/sync/modules/stages/enginesync.js
+++ b/services/sync/modules/stages/enginesync.js
@@ -136,8 +136,7 @@ EngineSynchronizer.prototype = {
try {
this._updateEnabledEngines();
} catch (ex) {
- this._log.debug("Updating enabled engines failed: " +
- Utils.exceptionStr(ex));
+ this._log.debug("Updating enabled engines failed: ", ex);
this.service.errorHandler.checkServerError(ex);
this.onComplete(ex);
return;
diff --git a/services/sync/modules/util.js b/services/sync/modules/util.js
index b063a29ac..12496d23a 100644
--- a/services/sync/modules/util.js
+++ b/services/sync/modules/util.js
@@ -77,7 +77,7 @@ this.Utils = {
return func.call(thisArg);
}
catch(ex) {
- thisArg._log.debug("Exception: " + Utils.exceptionStr(ex));
+ thisArg._log.debug("Exception: ", ex);
if (exceptionCallback) {
return exceptionCallback.call(thisArg, ex);
}