title: How to correctly trap and read any errors generated in a Promise.all call?
body: <p>I currently have a node.js/graphql micro service that uses Promise.all to call another micro service via apolloFetch. My Promise.all part seems to be working ok but I'm trying to have the error logging part working. I need to make sure that the Promise.all executes ALL THE PROMISES and not quit after it encounters the first error. Once it executes ALL THE PROMISES, I need to then populate an array meant just errors, which I then loop through and insert into a database using another function. I currently have the array and the catch set up, but when I intentionally generate an error, I don't see the array being populated.</p>
  
  <p>Could someone take a gander if my code is indeed doing what I'm intending it to do?</p>
  
  <pre><code>     const ErrorsArray = [];
       Promise.all(promises.map(p =&gt; apolloFetch({p}))).then((result) =&gt;                         
  
            {
                  resolve();
                  console.log("success!");
              }).catch((e) =&gt; {
                  ErrorsArray.push( e );
              });
       if( ErrorsArray &amp;&amp; ErrorsArray.length ){
          for(a=0;a&lt;ErrorsArray.length;a++){
            funcLogErrors( ErrorsArray[a].errorCode,         
                           ErrorsArray[a].message );
           //Not sure if these are correct^^^^^^^^^
          }
        }
  </code></pre>
  
  <p>PS: Also, how do I simulate a mySQL database error without shutting my database down, so I can test this function to make sure all the database errors are being caught as well?</p>