I've been trying to figure out how to send Client Side Exceptions to a Server for logging in an AngularJS application.
I've followed the following steps posted here: http://www.bennadel.com/blog/2542-Logging-Client-Side-Errors-With-AngularJS-And-Stacktrace-js.htm
This is working fine for some errors but does not seem to catch exceptions thrown in my directives.
E.g. my overriding of the exception handler:
app.provider("$exceptionHandler", {
$get: function( errorLogService ) {
return( errorLogService );
}
});
This works fine for exceptions from controllers but my directive just doesn't seem to go through my custom exception handler - it just logs directly to the console e.g.
app.directive('saveAndShowDialog', function() {
function link(scope, element, attrs) {
element.on('click', function(e) {
var x = y; // forces exception
scope.save();
});
}
return { restrict: 'A', link: link };
})
;
Can anyone give any direction as I've spent days on this and can't seem to get anywhere?
Thanks, Kevin.