Interviews2 answers
How to Log uncaught AngularJS errors to the backend?
2 Answers
in the browser , where u r executing your project, press f12 u will get to know the error coming in your code also where they r comin
Sakshi MahajanPosted May 29, 2017, 10:51 AM EDT
The example below will overwrite the default $exceptionHandler in order to log uncaught errors to the backend for later inspection by the developers using $log.warn() instead of $log.error().
angular.module('exceptionOverwrite', []).
factory('$exceptionHandler', ['$log', 'logErrorsToBackend', function($log, logErrorsToBackend) {
return function customExcHandler(excp, cause) {
logErrorsToBackend(excp, cause);
$log.warn(excp, cause);
};
}]);
Santosh Kumar AdidawarpuPosted Feb 11, 2017, 2:30 AM EST
