kriskowal/q

q is crashing with the following array

LohithBlaze opened this issue · 1 comments

                throw e;
                ^

TypeError: Array.prototype.reduce called on null or undefined
    at reduce (native)
    at ..\Desktop\exchangePrototypeHTML\node_modules\q\q.js:263:21
    at ..\exchangePrototypeHTML\node_modules\q\q.js:1565:9
    at _fulfilled (..\exchangePrototypeHTML\node_modules\q\q.js:834:54)
    at self.promiseDispatch.done (..\exchangePrototypeHTML\node_modules\q\q.js:863:30)
    at Promise.promise.promiseDispatch (..\exchangePrototypeHTML\node_modules\q\q.js:796:13)
    at ..\exchangePrototypeHTML\node_modules\q\q.js:604:44
    at runSingle (..\exchangePrototypeHTML\node_modules\q\q.js:137:13)
    at flush (..\exchangePrototypeHTML\node_modules\q\q.js:125:13)
    at _combinedTickCallback (node.js:370:9)

I'm sending a array of promises in waitArray and I'm returning a promise to the original caller of the Q.all return Q.all.apply(Q, waitArray);

In promise returned by this Q.all
I have applied a done handler

.done(function(){
                    dfd.resolve(dfdArray.length);
                });

This crashes If I dont handle the error.

can anyone have a look at this??

I think you're just using the API wrong. You shouldn't need apply. Q.all() takes one argument which must be an array of promises.

Q.all([promise1, promise2])