when.reduce - reject chain breaks with unhandled rejection warning

31 צפיות
מעבר להודעה הראשונה שלא נקראה

David Kebler

לא נקראה,
27 באוק׳ 2016, 2:23:2727.10.2016
עד cujojs
This is my when.reduce code

                return reduce(cmds, function(responses, cmd) {
                   
return processor(cmd).then(function(response) {
                        responses
.push(response); // or whatever
                       
return responses;
                   
})
               
}, [])


any rejection in processor or lower gets hung (unhandled) at when.reduce


(node:7520) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): manual rejection in processor
**Command Processing Errors**

 manual rejection
in processor
uCOMmandIt
> (node:7520) PromiseRejectionHandledWarning: Promise rejection was handled asynchronously (rejection id: 2)


on the other hand...resolutions bubble up fine

FINAL response back
[ 'manual resolution in processor' ]

to make sure it is when reduce I substituted this

return processor(cmds[0]);

and yes both resolutions and rejections bubble on through.

Is there an error  in my construction of the reducer function or is this a bug?

Note I am using the latest version of nodejs 6.9.1 which since 6.0 now throws these warnings for any unhandled rejections


David Kebler

לא נקראה,
27 באוק׳ 2016, 2:48:0027.10.2016
עד cujojs
it's the when library, I switched to bluebird and it runs without warnings
השב לכולם
השב למחבר
העבר לנמענים
0 הודעות חדשות