aboutsummaryrefslogtreecommitdiffstats
path: root/src/ng/exceptionHandler.js
diff options
context:
space:
mode:
authorMisko Hevery2012-03-23 14:03:24 -0700
committerMisko Hevery2012-03-28 11:16:35 -0700
commit2430f52bb97fa9d682e5f028c977c5bf94c5ec38 (patch)
treee7529b741d70199f36d52090b430510bad07f233 /src/ng/exceptionHandler.js
parent944098a4e0f753f06b40c73ca3e79991cec6c2e2 (diff)
downloadangular.js-2430f52bb97fa9d682e5f028c977c5bf94c5ec38.tar.bz2
chore(module): move files around in preparation for more modules
Diffstat (limited to 'src/ng/exceptionHandler.js')
-rw-r--r--src/ng/exceptionHandler.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/ng/exceptionHandler.js b/src/ng/exceptionHandler.js
new file mode 100644
index 00000000..26ea5845
--- /dev/null
+++ b/src/ng/exceptionHandler.js
@@ -0,0 +1,26 @@
+'use strict';
+
+/**
+ * @ngdoc function
+ * @name angular.module.ng.$exceptionHandler
+ * @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.
+ *
+ * In unit tests, if `angular-mocks.js` is loaded, this service is overridden by
+ * {@link angular.module.ngMock.$exceptionHandler mock $exceptionHandler}
+ *
+ * @param {Error} exception Exception associated with the error.
+ * @param {string=} cause optional information about the context in which
+ * the error was thrown.
+ */
+function $ExceptionHandlerProvider() {
+ this.$get = ['$log', function($log){
+ return function(exception, cause) {
+ $log.error.apply($log, arguments);
+ };
+ }];
+}