title: Do promises in AngularJS catch every exception/error?
body: <p>I've inherited a codebase at work that contains a dozen or so examples of the following pattern:</p>
  
  <pre><code>var promise = null;
  try {
      promise = backendService.getResults(input);
  }
  catch (exception) {
      console.err(exception);
  }
  if (promise !== null) {
      promise.then(function (response) {
          // do stuff
      })
      .catch(function (error) {
          console.err(error);
      });
  }
  </code></pre>
  
  <p>Where <code>backendService</code> is an Angular service that in turn calls a REST service through <code>$http</code>.</p>
  
  <p><strong>So here's my question: is that try/catch really necessary? Will there ever be any scenario where a particular error/exception is thrown that the promise's <code>.catch</code> fails to catch?</strong></p>
  
  <p>This has been the subject of a bit of debate on the team all morning, and the only resolution we've come up with is that we don't <em>think</em> it's necessary, but (a) changing it breaks the tests that were written alongside it (which would also need to be changed), and (b) well... it's defensive coding, right? It's not a Bad Thing.</p>
  
  <p>The merits of actually bothering to refactor it into oblivion when there are more important things to do aren't what I'm asking about, though. I just want to know if it's a reasonable pattern when promises are being passed around like this (in AngularJS specifically, if that makes a difference), or just paranoia.</p>