Sorry, one other phenomenon. It seems that this behavior is affected by the presence of a .finally block. If I throw a .finally after my .fail, the error remains "unhandled". Here's an example:
d = Q.defer()
d.promise.fail(
function(e) {
console.log("Got an error: " + e)
}
)
d.promise.finally(
function() {
console.log("Finally, all done!")
}
)
d.reject("Some failure")
setTimeout(function() {
console.log(Q.getUnhandledReasons().length)
}, 1000)
It's online at
http://jsfiddle.net/SQwhM/7/. When run, it seems that "Some failure" remains in the Q.getUnhandledReasons(). If I remove the .finally, it gets removed as expected.
Thoughts? Thanks again!
Norman