Reputation: 4954
When I build my code together, I'm getting an error instantiating the main module because it has a dependency on the below module, which is also getting an error instantiating. As far as I can tell I'm doing everything right to minsafe the module, but am I missing something?
angular.module('exceptionOverride').config(function($provide) {
$provide.decorator('$exceptionHandler', ['$delegate', '$injector',function($delegate,$injector) {
return function(exception, cause) {
var $rootScope = $injector.get('$rootScope');
var loggerService = $injector.get('loggerService');
$delegate(exception, cause);
exception.message = $rootScope.currentState + ': ' + exception.message;
//send the exception off to the logging service
loggerService.log(exception);
};
}]);
});
I can add code for other modules if you think it's needed.
Upvotes: 0
Views: 316
Reputation: 28750
You also have to do the config function: (notice the ['$provide', function($provide){ ...
)
angular.module('exceptionOverride').config(['$provide', function($provide) {
$provide.decorator('$exceptionHandler', ['$delegate', '$injector',function($delegate,$injector) {
return function(exception, cause) {
var $rootScope = $injector.get('$rootScope');
var loggerService = $injector.get('loggerService');
$delegate(exception, cause);
exception.message = $rootScope.currentState + ': ' + exception.message;
//send the exception off to the logging service
loggerService.log(exception);
};
}]);
}]);
Upvotes: 2