Hacker News new | ask | show | jobs
by gren 4404 days ago
An other common mistake when you begin with promise:

    var result = promise.then(identity, function (error) { console.log(error); })
Oops, you just recovered your promise with undefined. result will always be successful. Yes if you don't throw again (or return a new failure promise) in your error callback it will make the resulting promise successful.

I haven't checked if this behaviour is the same on the DOM Promise API but it is on Q (which is the most popular JS lib for Promises).