To began, I recommend not using the minified version of angular, as the unminified version allows more coherent and clear errors to be logged in the console.
Next, I think the best way to handle angular errors is to write a custom wrapper to better handle them. Here is an example of how you could write a wrapper.
The first step would be to write a function that will handle the error in a way that you want. This is how I current handle angular errors. Note: this could be modified in many different ways to make the error handling more customized.
function HandleAngularError(Exception, AppName){
try {
var AppName = (window.parent._.isEmpty(AppName) ? "Angular App Unspecified" : AppName) + " - ";
if (window.parent._.isUndefined(Exception)) {
console.log(strAppName + "error: exception undefined", "AngularJs");
} else {
console.log(strAppName + "error: " + Exception.toString() + " " + JSON.stringify(Exception), "AngularJs");
}
} catch (e) {
alert("Handle Angular Error: " + Exception.toString() + " " + JSON.stringify(Exception));
}
}
The next step is to include the error handling function in the any of the Modules in you project and rely on the $exceptionHandler to then pass angular errors into your custom wrapper like so:
angular.module("someApp",[], function(){
//setup stuff here
}).factory( '$exceptionHandler', function () {
return function (exception) {
HandleAngularError(exception, "someApp");
};
});