2011-07-17 08:05:43 +00:00
|
|
|
'use strict';
|
|
|
|
|
|
2011-02-15 06:12:45 +00:00
|
|
|
/**
|
2011-11-10 06:23:36 +00:00
|
|
|
* @ngdoc function
|
2012-06-12 06:49:24 +00:00
|
|
|
* @name ng.$exceptionHandler
|
2011-02-15 06:12:45 +00:00
|
|
|
* @requires $log
|
|
|
|
|
*
|
|
|
|
|
* @description
|
|
|
|
|
* Any uncaught exception in angular expressions is delegated to this service.
|
|
|
|
|
* The default implementation simply delegates to `$log.error` which logs it into
|
|
|
|
|
* the browser console.
|
|
|
|
|
*
|
2011-12-14 08:28:16 +00:00
|
|
|
* In unit tests, if `angular-mocks.js` is loaded, this service is overridden by
|
2013-01-17 02:01:03 +00:00
|
|
|
* {@link ngMock.$exceptionHandler mock $exceptionHandler} which aids in testing.
|
2011-12-14 08:28:16 +00:00
|
|
|
*
|
|
|
|
|
* @param {Error} exception Exception associated with the error.
|
|
|
|
|
* @param {string=} cause optional information about the context in which
|
|
|
|
|
* the error was thrown.
|
2013-01-17 02:01:03 +00:00
|
|
|
*
|
2011-02-15 06:12:45 +00:00
|
|
|
*/
|
2011-12-14 08:28:16 +00:00
|
|
|
function $ExceptionHandlerProvider() {
|
2011-11-02 23:32:46 +00:00
|
|
|
this.$get = ['$log', function($log){
|
2011-12-14 08:28:16 +00:00
|
|
|
return function(exception, cause) {
|
|
|
|
|
$log.error.apply($log, arguments);
|
2011-11-02 23:32:46 +00:00
|
|
|
};
|
|
|
|
|
}];
|
|
|
|
|
}
|