Promise that returns second promise result if first fails
<p>I would like to return the value of a second promise if the first (value in cache) fails. </p>

<p>I have the following code, but resolve is not defined.</p>

<pre><code>exports.getConfig = function (a, r) {
  return new Promise(resolve, reject)    {
    getConfigFromCache(a, r)
        .catch(function(e){
            getRouteConfigFromWeb(a, r)
        }).then(function(result) {
            //return value of the promise that was called
            resolve(result)
        })
  }
};
</code></pre>

<p>Assume that both getConfigFromCache and getRouteConfigFromWeb return promises correctly.</p>

<p>Is there a way to accomplish this, or am I thinking through it incorrectly?</p>