Skip to content

Commit

Permalink
Log errors from Zotero.serial()
Browse files Browse the repository at this point in the history
And output errors in concurrentCaller if not otherwise logged
  • Loading branch information
dstillman committed Jul 7, 2017
1 parent 71fb054 commit 3b2d7eb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 4 additions & 2 deletions chrome/content/zotero/xpcom/zotero.js
Expand Up @@ -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 () {
Expand Down
3 changes: 2 additions & 1 deletion resource/concurrentCaller.js
Expand Up @@ -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);
Expand Down

0 comments on commit 3b2d7eb

Please sign in to comment.