Cancel promises in Promise.map if one is rejected (Bluebird 3)
<p>I use Bluebird 3 with enabled cancellation.  Is cancellation the tool to use in the following use case:</p>

<pre><code>var resourcesPromise = Promise.map(resourceIds, function(id) {
    return loadResource(id);
});

resourcesPromise.catch(function() {
    resourcesPromise.cancel();
});`
</code></pre>

<p>If one of the resources fails to load, resourcesPromise will be rejected, and I want to stop the loading of all other resources.  But as far as I can tell, cancelling resourcesPromise doesn't work, because it is already rejected.</p>

<p>Edit:  I'm currently considering variants of the following:</p>

<pre><code>var resourcesPromise = new Promise(function(resolve, reject) {
    var intermediatePromise = Promise.map(resourceIds, function(id) {
        return loadResource(id).catch(function(error) {
            intermediatePromise.cancel();
            reject(error);
        });
    }).then(resolve, reject);
});
</code></pre>

<p>(I may have found a legitimate use for the ".then(resolve, reject)" anti-pattern!)</p>

<p>Any ideas why Promise.map doesn't work like that?</p>