If I understand correctly (promises API is very confusing), any error occurred in a promise is suppressed, so the following code:
$http.post(...)
.then(data => {
if (data.noGood) {
return $q.reject();
} else {
// Some bug.
var a = {};
return a.a.a > 3;
}
})
.catch(error => {
console.error('bad data');
});
is buggy, as badData
is not necessarily true if 'bad data'
is logged).
The desired behaviour for me is to see a console error upon every real runtime error, and leave handling rejections to me. Am I missing something here? What is the correct approach?
Checking if the error is Error
on each catch
block seems tedious.