diff --git a/chrome/content/zotero/xpcom/db.js b/chrome/content/zotero/xpcom/db.js index 92e105af10..44770a0736 100644 --- a/chrome/content/zotero/xpcom/db.js +++ b/chrome/content/zotero/xpcom/db.js @@ -439,6 +439,7 @@ Zotero.DBConnection.prototype.executeTransaction = async function (func, options var resolve; var startedTransaction = false; + var committed = false; var id = Zotero.Utilities.randomString(); try { @@ -488,6 +489,7 @@ Zotero.DBConnection.prototype.executeTransaction = async function (func, options } result = await conn.executeTransaction(func); + committed = true; this._commitCount++; Zotero.debug(`Committed DB transaction ${id}`, 4); } @@ -516,15 +518,28 @@ Zotero.DBConnection.prototype.executeTransaction = async function (func, options this._callbacks.current.rollback = []; // Run temporary commit callbacks + // + // The transaction is already committed, so errors in commit callbacks are logged + // rather than being treated as transaction failures var f; while (f = this._callbacks.current.commit.shift()) { - await Promise.resolve(f(id)); + try { + await Promise.resolve(f(id)); + } + catch (e) { + Zotero.logError(e); + } } // Run commit callbacks for (var i=0; i