title: Nodejs promises - how to catch function that does not resolve the promise?
body: <p>Is there a way to catch the case when one of the functions does not resolve the promise and to output message about it? </p>
  
  <p>This is my code: </p>
  
  <pre><code>var Q = require("q");
  
  var badFunction = function (resolve, reject, notify) {
      console.log('bad function');
  }
  
  var q = Q.Promise(badFunction)
  .then(function (output) {
      console.log('bad function returned: ' + output);
  }).catch(function (err) {
      console.log('catch');
      throw err;
  }).done();
  </code></pre>
  
  <p>This is what I see in console:</p>
  
  <pre><code>Polinas-MacBook:me3 polina$ node spike
  bad function
  Polinas-MacBook:me3 polina$ 
  </code></pre>