title: JS Q library - defer error catching
body: <p>I'm discovering Kris Koval Q library and I have a problem. Look at this simple code:</p>
  
  <pre><code>function getPromise1() {
      var deferred = Q.defer();
      setTimeout(function () {
          console.log('Promise 1 OK');
          deferred.resolve();
      }, 1000);
      return deferred.promise;
  }
  
  
  function getPromise2() {
      var deferred = Q.defer();
      setTimeout(function () {
          console.log('Promise 2 Failed');
          deferred.reject();
      }, 1000);
      return deferred.promise;
  }
  
  getPromise1()
      .then(getPromise2())
      .fail(function () {
          alert('Fail!');
      })
      .done();
  </code></pre>
  
  <p>I expect to see:</p>
  
  <pre><code>Promise 1 OK
  Promise 2 Failed
  </code></pre>
  
  <p>and then show alert "Fail!", but the alert never shows. Instead of that I see warning in my console:</p>
  
  <pre><code>[Q] Unhandled rejection reasons (should be empty): ["(no stack) undefined"] 
  </code></pre>
  
  <p>Why rejection is not handled and how can I handle it?</p>