await q.push(task) is not safe for use for the moment because the promise returned by q.push never resolve nor reject if the queue worker throws an error. I understand that await q.push(task) cannot throw an error because of the backward compatibility of this method and its optional callback parameter (the push and forget feature). A q.asyncPush(task) method that rejects its promise shouldn't be feasible ?
You can show the problem with this code (in node or browser without the require):
const async = require('async');
let pushResult;
(async () => {
const q = async.queue(async (task) => {
throw new Error('Bad thing');
});
try {
pushResult = q.push({some: 'data'});
await pushResult;
console.log('Error not catched');
} catch (e) {
console.log('Error catched');
}
})();
setTimeout(() => {
console.log('exit');
console.log(pushResult);
}, 1000);
Originally posted by @darksabrefr in #1641 (comment)
await q.push(task)is not safe for use for the moment because the promise returned byq.pushnever resolve nor reject if the queue worker throws an error. I understand thatawait q.push(task)cannot throw an error because of the backward compatibility of this method and its optional callback parameter (the push and forget feature). Aq.asyncPush(task)method that rejects its promise shouldn't be feasible ?You can show the problem with this code (in node or browser without the require):
Originally posted by @darksabrefr in #1641 (comment)