title: Handling errors in promise chains
body: <p>There are two categories of errors that might occur in a promise chain.</p>
  
  <ol>
  <li>Errors thrown from inside the promise chain (dealt with by <code>.catch</code>)</li>
  <li>Errors thrown when configuring the promise chain</li>
  </ol>
  
  <p>My question is how best to deal with the latter.</p>
  
  <p>For example, in the following <code>.catch</code> will not catch exceptions thrown by <code>foo</code> before it has had a chance to return a promise.</p>
  
  <pre><code>function go() {
      return foo()
          .then(bar)
          .catch(bam);
  }
  </code></pre>
  
  <p>Clearly I can wrap the contents of <code>go</code> in a <code>try-catch</code> block.</p>
  
  <p>But would it be better to return an immediately rejected promise from a catch block in <code>foo</code> to "maintain the API" and have a promise-based interface for all eventualities?</p>