title: break promise.all on catch
body: <p>I have a promise implementation like the one on <a href="https://developer.mozilla.org/nl/docs/Web/JavaScript/Reference/Global_Objects/Promise/all" rel="nofollow">MDN</a>:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>    var p1 = new Promise((resolve, reject) =&gt; {
          setTimeout(resolve, 1000, "one");
      });
      var p2 = new Promise((resolve, reject) =&gt; {
          setTimeout(resolve, 2000, "two");
      });
      var p3 = new Promise((resolve, reject) =&gt; {
          setTimeout(resolve, 3000, "three");
      });
      var p4 = new Promise((resolve, reject) =&gt; {
          setTimeout(resolve, 4000, "four");
      });
      var p5 = new Promise((resolve, reject) =&gt; {
          reject("reject");
      });
      
      Promise.all([p1, p2, p3, p4, p5]).then(value =&gt; {
          console.log(value);
      }, function(reason) {
          console.log(reason)
      });</code></pre>
  </div>
  </div>
  </p>
  
  <p>This does fast error-catching:</p>
  
  <blockquote>
    <p><code>Promise.all</code> is rejected if one of the elements is rejected and <code>Promise.all</code> fails fast: If you have four promises which resolve after a <code>timeout</code>, and one calls <code>reject</code> immediately, then <code>Promise.all</code> rejects immediately.</p>
  </blockquote>
  
  <p>However, the functions inside a <code>promise</code> don't stop running. What I want, is that if one function does a <code>reject</code>, the other functions stop running (preventing useless messages to a user).</p>
  
  <p>Example of a promise that keeps running after the reject:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var p1 = new Promise((resolve, reject) =&gt; {
      setTimeout(resolve, 1000, "one");
  });
  var p2 = new Promise((resolve, reject) =&gt; {
      setTimeout(resolve, 2000, "two");
  });
  var p3 = new Promise((resolve, reject) =&gt; {
      setTimeout(resolve, 3000, "three");
  });
  var p4 = new Promise((resolve, reject) =&gt; {
      setTimeout(() =&gt; {
          console.log('Don\'t show this after a reject!');
          resolve();
      }, 4000);
  });
  var p5 = new Promise((resolve, reject) =&gt; {
      reject("reject");
  });
  
  Promise.all([p1, p2, p3, p4, p5]).then(value =&gt; {
      console.log(value);
  }, function(reason) {
      console.log(reason)
  });</code></pre>
  </div>
  </div>
  </p>