commit 3b2d7eb9708c56f8e30a9eed1af69637e78b9cc4 parent 71fb054efeb60358d2248d4869c38f0362d6eb16 Author: Dan Stillman <dstillman@zotero.org> Date: Fri, 7 Jul 2017 05:20:31 -0400 Log errors from Zotero.serial() And output errors in concurrentCaller if not otherwise logged Diffstat:
| M | chrome/content/zotero/xpcom/zotero.js | | | 6 | ++++-- |
| M | 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 @@ -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 @@ -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);