diff --git a/chrome/content/zotero/xpcom/data/relations.js b/chrome/content/zotero/xpcom/data/relations.js index 323488362..413035e64 100644 --- a/chrome/content/zotero/xpcom/data/relations.js +++ b/chrome/content/zotero/xpcom/data/relations.js @@ -229,21 +229,27 @@ Zotero.Relations = new function () { var uris = Zotero.DB.columnQuery(sql, [this.deletedItemPredicate, this.deletedItemPredicate]); if (uris) { var prefix = Zotero.URI.defaultPrefix; - Zotero.DB.beginTransaction(); - for each(var uri in uris) { - // Skip URIs that don't begin with the default prefix, - // since they don't correspond to local items - if (uri.indexOf(prefix) == -1) { - continue; - } - if (uri.indexOf(/\/items\//) != -1 && !Zotero.URI.getURIItem(uri)) { - this.eraseByURI(uri); - } - if (uri.indexOf(/\/collections\//) != -1 && !Zotero.URI.getURICollection(uri)) { - this.eraseByURI(uri); + try { + Zotero.DB.beginTransaction(); + for each(var uri in uris) { + // Skip URIs that don't begin with the default prefix, + // since they don't correspond to local items + if (uri.indexOf(prefix) == -1) { + continue; + } + if (uri.indexOf(/\/items\//) != -1 && !Zotero.URI.getURIItem(uri)) { + this.eraseByURI(uri); + } + if (uri.indexOf(/\/collections\//) != -1 && !Zotero.URI.getURICollection(uri)) { + this.eraseByURI(uri); + } } + Zotero.DB.commitTransaction(); + } + catch (e) { + Zotero.debug(e); + Zotero.debug(Zotero.DB.query("SELECT * FROM relations")); } - Zotero.DB.commitTransaction(); } }