title: attempting to break jQuery promise chain with .then, .fail and .reject
body: <p>Update: this issue was a result of jQuery 1.7 vs 1.8. Do not ever use promises in 1.7 beacuse they aren't chainable with returning a promise inside a <code>.then</code>. 1.8 looks like they didn't mess it up.</p>
  
  <p><a href="http://jsfiddle.net/delvarworld/28TDM/">http://jsfiddle.net/delvarworld/28TDM/</a></p>
  
  <pre><code>// make a promise
  var deferred = $.Deferred();
  promise = deferred.promise();
  
  // return a promise, that after 1 second, is rejected
  promise.then(function(){
      var t = $.Deferred();
      setTimeout(function() {
          console.log('rejecting...');
          t.reject();
      }, 1000);
  
      return t.promise();
  });
  
  // if that promise is successful, do this
  promise.then(function() {
      console.log('i should never be called');
  })
  
  // if it errors, do this
  promise.fail(function() {
      console.log('i should be called');
  });
  
  deferred.resolve();
  </code></pre>
  
  <p>Expected: 'i should be called'</p>
  
  <p>Actual: 'i should never be called'</p>
  
  <p><strong>Problem</strong>: I want to chain callbacks and have any one of them be able to break the chain and  trigger the <code>fail</code> function, and skip the other chained callbacks. I don't understand why all of the thens are triggered and the fail is not triggered.</p>
  
  <p>I'm coming from NodeJS's Q library, so I tried it with <code>.then</code> first. However, changing it to <code>.pipe</code> has no effect.</p>