title: How can I bubble errors on Promises without calling `catch` at every level?
body: <p>I'm struggling to figure out how to <em>properly</em> bubble errors with promises.</p>
  
  <p>Specifically, what I'm talking about is a situation where there is <em>nested promises</em>. I want to be able to <em>implictly</em> pass the <code>resolve</code> and <code>reject</code> functions to the nested promise.</p>
  
  <p>It'll be more obvious what I mean by showing some code.</p>
  
  <p>The following is what I have been using successfully:</p>
  
  <pre><code>var asyncIsEven = function(number) {
    return new Promise(function(resolve, reject){
        if (number % 2 == 0) { return resolve(number) }
        else { return reject("number is odd") }
    })
  }
  
  var A = function (number) {
    return new Promise(function(resolve, reject){
      return asyncIsEven(number).then(resolve).catch(reject)
    })
  }
  </code></pre>
  
  <p>Here, it seems pretty unnecessary to write <code>then(resolve).catch(reject)</code>. 
  I understand that I can just make function <code>A</code> return <code>asyncIsEven(number)</code>, but there are situations when I want to provide a <code>then</code> function but have no need to provide a <code>catch</code> function (or vice versa).</p>
  
  <p>What I've tried:</p>
  
  <p><strong>this works, but is not really what I want because I'm not providing a <code>then</code> handler to the nested callback</strong></p>
  
  <pre><code>var A = function (number) {
    return Promise.all([asyncIsEven(number)])
  }
  
  // or alternatively
  var A = function(number) {
    return asyncIsEven(number)
  }
  </code></pre>
  
  <p><strong>This is what I want to write, but it doesn't work</strong></p>
  
  <pre><code>var A = function(number) {
    return new Promise(function(resolve, reject) {
      return asyncIsEven(number).then(resolve)
    })
  }
  </code></pre>
  
  <p>When I say it "doesnt work", what I mean is that I cannot write the following:</p>
  
  <pre><code>A(2).then(function(number) {
    console.log(`${number} is even`)
  }).catch(function(err) {
    console.log(err)
  })
  </code></pre>
  
  <p>Because the <code>catch</code> function will never be called.</p>
  
  <p>In other words - if I define function <code>A</code> to return <code>asyncIsEven(number).then(resolve)</code>, how can I bubble errors from <code>asyncIsEven</code> up to the <code>reject</code> callback given to <code>A</code>?</p>