From 3b2d7eb9708c56f8e30a9eed1af69637e78b9cc4 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Fri, 7 Jul 2017 05:20:31 -0400 Subject: [PATCH] Log errors from Zotero.serial() And output errors in concurrentCaller if not otherwise logged --- chrome/content/zotero/xpcom/zotero.js | 6 ++++-- resource/concurrentCaller.js | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/chrome/content/zotero/xpcom/zotero.js b/chrome/content/zotero/xpcom/zotero.js index c4583001ee..b58741282d 100644 --- a/chrome/content/zotero/xpcom/zotero.js +++ b/chrome/content/zotero/xpcom/zotero.js @@ -1494,8 +1494,10 @@ Services.scriptloader.loadSubScript("resource://zotero/polyfill.js"); this.serial = function (fn) { Components.utils.import("resource://zotero/concurrentCaller.js"); - var caller = new ConcurrentCaller(1); - caller.setLogger(Zotero.debug); + var caller = new ConcurrentCaller({ + numConcurrent: 1, + onError: e => Zotero.logError(e) + }); return function () { var args = arguments; return caller.start(function () { diff --git a/resource/concurrentCaller.js b/resource/concurrentCaller.js index 0e3c531047..fb64934cd2 100644 --- a/resource/concurrentCaller.js +++ b/resource/concurrentCaller.js @@ -223,7 +223,8 @@ ConcurrentCaller.prototype._processNext = function () { this._numRunning--; this._log("Error in function (" + this._numRunning + "/" + this.numConcurrent + ", " - + this._queue.length + " in queue)"); + + this._queue.length + " in queue)" + + ((!this.onError && !this.stopOnError) ? ": " + e : "")); if (this.onError) { this.onError(e);