Bluebird Promise.settle does not allow valid values

I have the following code:

return Promise.settle(matches, imgur.uploadUrl)
    .map(function (inspection) {
        if (inspection.isFulfilled()) {
            return inspection.value().data.link;
        }
        return '#';
    })

In a more detailed version, the same problems are shown above:

return Promise.settle(matches, function(match) { return imgur.uploadUrl(match); })
    .then(function(results) {
        return results;
    })
    .map(function (inspection) {
        if (inspection.isFulfilled()) {
            return inspection.value().data.link;
        }
        return '#';
    })

Where

The expected behavior is that the result .mapis a promise that is resolved using the imgur array of links after the images in the original array were loaded into imgur (or "#" if the download failed for some reason).

, Promise.settle (.. , imgur), inspection.value() - URL- matches ( .data.link ).

? ?

+4
2

Bluebird Promise.settle(), , ( promises). Promise.all(), , promises , .

, Bluebird .settle(), , ? , , Promise.settle() - ( , - ).

, :

Promise.settle(matches.map(imgur.uploadUrl)).then(...)

promises .settle().


FYI, , Promise.settle() , , . , -, , . , - , , .

+4

โ€‹โ€‹. ( OP ).

.settle.

+4

All Articles