I am using Cujo's great When library to provide a Promises/A+ implementation for my Node project, although this question is not node-specific.
Generally, When's great: it lets me write more maintainable, readable code.
However, when my callbacks fail unexpectedly (accessing a property of a null variable, etc), the exceptions are effectively swallowed by When, as seems to be specified by the Promises/A+ spec. Unfortunately, this means I don't get any feedback about the error (other than the callback stops executing at that point). No error type or message, no line number.
// hypothetical asynchronous database query
var silly = 3.141592654;
silly(); // TypeError: number is not a function!
process(result); // this code is silently never executed
console.log('I got here 123')
Ok, so summing up the information from the comments and add some.
.donemethod that explicitly declares the chain has ended, this causes uncaught rejections to be thrown. Libraries like When and Q solve the problem this way. For example if your
.doneyou'd get a long stack trace.
require('when/monitor/console'); // when will now log async rejections used with // `then` , this is experimental in when.
Promise.longStackTraces(); // Bluebird always logs async rejections but with this // option it will stitch the asynchronous context stack // for you in your methods.