title: How to re-run a javascript promise when failed?
body: <p>I have the following code where I am trying to convert a list of 10-15 addresses in the <code>businesses</code> array into lat/lng coordinates using Google Maps Geocoding API.</p>
  
  <pre><code>var geocoder = new google.maps.Geocoder();
  
  var proms = businesses.map(function(address) {
      return prom = new Promise(function(resolve) {
         geocoder.geocode({
              address: address
          }, function(results, status) {
  
              if (status === google.maps.GeocoderStatus.OK) {
                  resolve({
                      results: results,
                      business: address
                  });
  
              } else if (status === google.maps.GeocoderStatus.OVER_QUERY_LIMIT) {
                  setTimeout(function() {
                      //HOW DO I RE-RUN THIS "new Promise"?
                  }, 1000);
  
              } else {
                  console.log(status + ': ' + results);
              }
  
          });
      });
  });
  Promise.all(proms);
  </code></pre>
  
  <p>The problem is that Google's API will sometimes return an <code>OVER_QUERY_LIMIT</code> error so I was wondering if there's a way to re-run the promise that failed after a few seconds. In the example above the <code>else if</code> statement catches the error, so how would I make it rerun after a timeout?</p>
  
  <p>Note that I just started using promises and don't have a good understanding yet how they work so my approach might be completely wrong. Also all of this is done under the assumption that Google's API won't let me resolve addresses in bulk, if that's not the case - please, let me know.</p>