$q reports errors in promise callbacks even when they are caught #7992
Description
Plunker: http://plnkr.co/edit/5vMj4AJibWcnTKYR5z73?p=preview
I have caught the error and used it to display useful information to my user in the UI. However, Angular still logs a big ol' stack trace to the console.
This isn't a spec compliance issue (since the error isn't thrown, just logged), but it's a developer ergonomics issue. I don't understand how using $q on any reasonably large promise project would not just result in a console filled with spurious errors.
As always, the correct time to report a rejection as unhandled is debatable. Bluebird does it at the end of turn, whereas Q doesn't do it at all, relying on .done()
instead. But this isn't even about unhandled rejections---it's about all rejections!
The Bluebird strategy seems like a pure win: it would remove this spurious reporting, but keep it for any cases that could potentially be real.