Answer the question
In order to leave comments, you need to log in
How to prevent throw errors inside the then sections of the Promise Q library?
I'm using the Q promise library in Angular 1.
I have this code:
$q((resolve, reject) => {
resolve(1);
}).then(function(ret) {
throw new Error("o_O");
}).catch(function(err) {
console.log(err);
});
Answer the question
In order to leave comments, you need to log in
Looks like I found a way around this problem. Instead of throw, you can use $q.reject. Then at least their own exceptions will not be duplicated.
$q((resolve, reject) => {
resolve(1);
}).then(function(ret) {
//throw new Error("o_O");
return $q.reject(new Error("o_O"));
}).catch(function(err) {
console.log(err);
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question