Log errors from Zotero.serial()

And output errors in concurrentCaller if not otherwise logged
This commit is contained in:
Dan Stillman 2017-07-07 05:20:31 -04:00
parent 71fb054efe
commit 3b2d7eb970
2 changed files with 6 additions and 3 deletions

View file

@ -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 () {

View file

@ -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);