From dcb7c88ebd1c01be658744dab69d1b66a98b3855 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Thu, 25 Feb 2016 01:45:09 -0500 Subject: [PATCH] Misc. debug output cleanup --- chrome/content/zotero/xpcom/data/cachedTypes.js | 4 ++-- chrome/content/zotero/xpcom/data/item.js | 4 ++-- chrome/content/zotero/xpcom/sync/syncEngine.js | 5 +++-- chrome/content/zotero/xpcom/sync/syncLocal.js | 8 +++++--- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/chrome/content/zotero/xpcom/data/cachedTypes.js b/chrome/content/zotero/xpcom/data/cachedTypes.js index efbc48c5d..29b2ad5c8 100644 --- a/chrome/content/zotero/xpcom/data/cachedTypes.js +++ b/chrome/content/zotero/xpcom/data/cachedTypes.js @@ -87,7 +87,7 @@ Zotero.CachedTypes = function() { } if (!this._types['_' + idOrName]) { - Zotero.debug('Unknown ' + this._typeDesc + ' ' + idOrName, 1); + Zotero.debug(`Unknown ${this._typeDesc} '${idOrName}'`, 1); return ''; } @@ -108,7 +108,7 @@ Zotero.CachedTypes = function() { } if (!this._types['_' + idOrName]) { - Zotero.debug('Unknown ' + this._typeDesc + ' ' + idOrName, 1); + Zotero.debug(`Unknown ${this._typeDesc} '${idOrName}'`, 1); return false; } diff --git a/chrome/content/zotero/xpcom/data/item.js b/chrome/content/zotero/xpcom/data/item.js index 341f290b0..0915448f7 100644 --- a/chrome/content/zotero/xpcom/data/item.js +++ b/chrome/content/zotero/xpcom/data/item.js @@ -4010,7 +4010,7 @@ Zotero.Item.prototype.fromJSON = function (json) { default: let fieldID = Zotero.ItemFields.getID(field); if (!fieldID) { - Zotero.logError("Discarding unknown JSON field " + field + " for item " + Zotero.logError("Discarding unknown JSON field '" + field + "' for item " + this.libraryKey); continue; } @@ -4019,7 +4019,7 @@ Zotero.Item.prototype.fromJSON = function (json) { this.itemTypeID ); if (!isValidForType[field]) { - Zotero.logError("Discarding invalid field " + field + " for type " + itemTypeID + Zotero.logError("Discarding invalid field '" + field + "' for type " + itemTypeID + " for item " + this.libraryKey); continue; } diff --git a/chrome/content/zotero/xpcom/sync/syncEngine.js b/chrome/content/zotero/xpcom/sync/syncEngine.js index b71845bb5..9c77c3c1e 100644 --- a/chrome/content/zotero/xpcom/sync/syncEngine.js +++ b/chrome/content/zotero/xpcom/sync/syncEngine.js @@ -437,7 +437,8 @@ Zotero.Sync.Data.Engine.prototype._downloadUpdatedObjects = Zotero.Promise.corou var objectTypePlural = Zotero.DataObjectUtilities.getObjectTypePlural(objectType); // Get versions of all objects updated remotely since the current local library version - Zotero.debug("Checking for updated " + objectTypePlural + " in " + this.library.name); + Zotero.debug(`Checking for updated ${options.top ? 'top-level ' : ''}` + + `${objectTypePlural} in ${this.library.name}`); var queryParams = {}; if (libraryVersion) { queryParams.since = libraryVersion; @@ -1305,7 +1306,7 @@ Zotero.Sync.Data.Engine.prototype._processCache = function (objectType) { Zotero.Sync.Data.Engine.prototype._failedCheck = function () { if (this.stopOnError && this.failed) { - Zotero.debug("STOPPING ON ERROR 1"); + Zotero.logError("Stopping on error"); throw this.failed; } }; diff --git a/chrome/content/zotero/xpcom/sync/syncLocal.js b/chrome/content/zotero/xpcom/sync/syncLocal.js index 0a9c95e41..ccf98fade 100644 --- a/chrome/content/zotero/xpcom/sync/syncLocal.js +++ b/chrome/content/zotero/xpcom/sync/syncLocal.js @@ -453,8 +453,7 @@ Zotero.Sync.Data.Local = { let jsonData = json.data; let objectKey = json.key; - Zotero.debug(`Processing ${objectType} ${libraryID}/${objectKey} ` - + "from sync cache"); + Zotero.debug(`Processing ${objectType} ${libraryID}/${objectKey}`); Zotero.debug(json); if (!jsonData) { @@ -555,7 +554,10 @@ Zotero.Sync.Data.Local = { if (objectType != 'item') { throw new Error(`Unexpected conflict on ${objectType} object`); } - Zotero.debug("Conflict!"); + Zotero.debug("Conflict!", 2); + Zotero.debug(jsonDataLocal); + Zotero.debug(jsonData); + Zotero.debug(result); conflicts.push({ left: jsonDataLocal, right: jsonData,