In the documentation Using JavaScript Promises it is mentioned
To show an error message in a catch() method, use $A.reportError()
Why would I want to use $A.reportError
that at all? I could use console.error()
, for instance, to report all errors caught in catch
.
Also in that docs I read the following statement
If you don't have a catch() method, keep an eye on your browser’s console during development for reports about uncaught errors in a promise.
This phrase during development for reports about uncaught errors made me wonder, does it mean that we need catch()
and $A.reportError
for a developer to be able to conveniently spot any unhanded errors during development? And theoretically, in production we shouldn't even get these unhanded errors.