angular logs all errors for the console by default.
angular also provides the ability to override this behavior. $exceptionHandler is a global service that gets the ability to handle any exceptions ($ http, errors during $ digest, etc.).
If you add this piece of code:
myApp.factory('$exceptionHandler', function() { return function(exception, cause) { exception.message += ' (caused by "' + cause + '")';
Then all errors simply stopped further logging. At least catch () handlers. Updated fiddle: http://jsfiddle.net/5jjx5rn3/
UPDATE:
As pointed out in dnc253 comments, there is a better way if you intend to actually override the angularjs service. Even without being the center of attention of this issue, it is better to know that simply by declaring a service with the same name, in any module the service is completely replaced (last winnings). If you want to add functionality around the original service, decorator is the right choice.
source share