Log errors from Zotero.serial()
And output errors in concurrentCaller if not otherwise logged
This commit is contained in:
parent
71fb054efe
commit
3b2d7eb970
2 changed files with 6 additions and 3 deletions
|
@ -1494,8 +1494,10 @@ Services.scriptloader.loadSubScript("resource://zotero/polyfill.js");
|
||||||
|
|
||||||
this.serial = function (fn) {
|
this.serial = function (fn) {
|
||||||
Components.utils.import("resource://zotero/concurrentCaller.js");
|
Components.utils.import("resource://zotero/concurrentCaller.js");
|
||||||
var caller = new ConcurrentCaller(1);
|
var caller = new ConcurrentCaller({
|
||||||
caller.setLogger(Zotero.debug);
|
numConcurrent: 1,
|
||||||
|
onError: e => Zotero.logError(e)
|
||||||
|
});
|
||||||
return function () {
|
return function () {
|
||||||
var args = arguments;
|
var args = arguments;
|
||||||
return caller.start(function () {
|
return caller.start(function () {
|
||||||
|
|
|
@ -223,7 +223,8 @@ ConcurrentCaller.prototype._processNext = function () {
|
||||||
this._numRunning--;
|
this._numRunning--;
|
||||||
|
|
||||||
this._log("Error in function (" + this._numRunning + "/" + this.numConcurrent + ", "
|
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) {
|
if (this.onError) {
|
||||||
this.onError(e);
|
this.onError(e);
|
||||||
|
|
Loading…
Add table
Reference in a new issue