You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Specifically in nodejs (v0.12.7). I'm using Q for promises, but I think the same will happen with others.
Some sample code:
var Q = require('q');
var Queue = require('promise-queue');
Queue.configure(function (handler) {
var deferred = Q.defer();
try {
handler(deferred.resolve, deferred.reject, deferred.notify);
} catch (e) {
console.error(e);
deferred.reject(e);
}
return deferred.promise;
});
var maxConcurrent = 1;
var maxQueue = Infinity;
var serialQueue = new Queue(maxConcurrent, maxQueue);
serialQueue.add(function() {
throw new Error('error that is caught');
});
serialQueue.add(function() {
throw new Error('error that is not caught');
});
My thought is that the first one works because the _dequeue is directly in the try/catch. However on subsequent calls when the _dequeue is called from the then/reject the scope changes and it's not in the try/catch block anymore.
I was going to take a stab at a PR, but not sure the best way of handling it or if it's even possible without changing the interface.
The text was updated successfully, but these errors were encountered:
Specifically in nodejs (v0.12.7). I'm using Q for promises, but I think the same will happen with others.
Some sample code:
My thought is that the first one works because the _dequeue is directly in the try/catch. However on subsequent calls when the _dequeue is called from the then/reject the scope changes and it's not in the try/catch block anymore.
I was going to take a stab at a PR, but not sure the best way of handling it or if it's even possible without changing the interface.
The text was updated successfully, but these errors were encountered: