Misc. debug output cleanup

This commit is contained in:
Dan Stillman 2016-02-25 01:45:09 -05:00
parent 63e169c139
commit dcb7c88ebd
4 changed files with 12 additions and 9 deletions

View File

@ -87,7 +87,7 @@ Zotero.CachedTypes = function() {
} }
if (!this._types['_' + idOrName]) { if (!this._types['_' + idOrName]) {
Zotero.debug('Unknown ' + this._typeDesc + ' ' + idOrName, 1); Zotero.debug(`Unknown ${this._typeDesc} '${idOrName}'`, 1);
return ''; return '';
} }
@ -108,7 +108,7 @@ Zotero.CachedTypes = function() {
} }
if (!this._types['_' + idOrName]) { if (!this._types['_' + idOrName]) {
Zotero.debug('Unknown ' + this._typeDesc + ' ' + idOrName, 1); Zotero.debug(`Unknown ${this._typeDesc} '${idOrName}'`, 1);
return false; return false;
} }

View File

@ -4010,7 +4010,7 @@ Zotero.Item.prototype.fromJSON = function (json) {
default: default:
let fieldID = Zotero.ItemFields.getID(field); let fieldID = Zotero.ItemFields.getID(field);
if (!fieldID) { if (!fieldID) {
Zotero.logError("Discarding unknown JSON field " + field + " for item " Zotero.logError("Discarding unknown JSON field '" + field + "' for item "
+ this.libraryKey); + this.libraryKey);
continue; continue;
} }
@ -4019,7 +4019,7 @@ Zotero.Item.prototype.fromJSON = function (json) {
this.itemTypeID this.itemTypeID
); );
if (!isValidForType[field]) { 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); + " for item " + this.libraryKey);
continue; continue;
} }

View File

@ -437,7 +437,8 @@ Zotero.Sync.Data.Engine.prototype._downloadUpdatedObjects = Zotero.Promise.corou
var objectTypePlural = Zotero.DataObjectUtilities.getObjectTypePlural(objectType); var objectTypePlural = Zotero.DataObjectUtilities.getObjectTypePlural(objectType);
// Get versions of all objects updated remotely since the current local library version // 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 = {}; var queryParams = {};
if (libraryVersion) { if (libraryVersion) {
queryParams.since = libraryVersion; queryParams.since = libraryVersion;
@ -1305,7 +1306,7 @@ Zotero.Sync.Data.Engine.prototype._processCache = function (objectType) {
Zotero.Sync.Data.Engine.prototype._failedCheck = function () { Zotero.Sync.Data.Engine.prototype._failedCheck = function () {
if (this.stopOnError && this.failed) { if (this.stopOnError && this.failed) {
Zotero.debug("STOPPING ON ERROR 1"); Zotero.logError("Stopping on error");
throw this.failed; throw this.failed;
} }
}; };

View File

@ -453,8 +453,7 @@ Zotero.Sync.Data.Local = {
let jsonData = json.data; let jsonData = json.data;
let objectKey = json.key; let objectKey = json.key;
Zotero.debug(`Processing ${objectType} ${libraryID}/${objectKey} ` Zotero.debug(`Processing ${objectType} ${libraryID}/${objectKey}`);
+ "from sync cache");
Zotero.debug(json); Zotero.debug(json);
if (!jsonData) { if (!jsonData) {
@ -555,7 +554,10 @@ Zotero.Sync.Data.Local = {
if (objectType != 'item') { if (objectType != 'item') {
throw new Error(`Unexpected conflict on ${objectType} object`); 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({ conflicts.push({
left: jsonDataLocal, left: jsonDataLocal,
right: jsonData, right: jsonData,