I use the library of promises Q in Angulyar 1. I have this code:
$q((resolve, reject) => { resolve(1); }).then(function(ret) { throw new Error("o_O"); }).catch(function(err) { console.log(err); }); The console displays the error throw new Error ("o_O");
And then this error is displayed again console.log (err);
I want to display an error only in the catch section.
How to prevent the output of errors by throw inside the then sections?
Code example:
http://plnkr.co/edit/MiH48Qb7tfCEW31mz1ou?p=preview
To reproduce the problem, you must first open the browser console, then run the example and in the console you will see what is displayed first by throw, and then by console.log).