Skip to content

Commit

Permalink
Avoid error. Differs from Zotero. Maybe not a good idea. But seems re…
Browse files Browse the repository at this point in the history
…latively safe.
  • Loading branch information
fbennett committed May 10, 2017
1 parent 5685710 commit 1c755c6
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions chrome/content/zotero/xpcom/data/item.js
Expand Up @@ -4048,18 +4048,23 @@ Zotero.Item.prototype.setCollections = function (collectionIDsOrKeys) {
}

// Convert any keys to ids

// XXX Juris-M change: Apply filter to drop out collections that are missing.
// XXX (possibly unwise)

var collectionIDs = collectionIDsOrKeys.map(function (val) {
if (parseInt(val) == val) {
return parseInt(val);
}
var id = this.ContainerObjectsClass.getIDFromLibraryAndKey(this.libraryID, val);
if (!id) {
let e = new Error("Collection " + val + " not found for item " + this.libraryKey);
e.name = "ZoteroObjectNotFoundError";
throw e;
// let e = new Error("Collection " + val + " not found for item " + this.libraryKey);
// e.name = "ZoteroObjectNotFoundError";
// throw e;
Zotero.debug("JM Warning (formerly Zotero error): Collection " + val + " not found for item " + this.libraryKey);
}
return id;
}.bind(this));
}.bind(this)).filter(function(x) { return x; });
collectionIDs = Zotero.Utilities.arrayUnique(collectionIDs);

if (Zotero.Utilities.arrayEquals(this._collections, collectionIDs)) {
Expand Down

0 comments on commit 1c755c6

Please sign in to comment.