diff options
| author | Misko Hevery | 2011-12-14 09:28:16 +0100 |
|---|---|---|
| committer | Misko Hevery | 2012-01-25 11:46:34 -0800 |
| commit | 84823b2eff21060c0883f6b4da5573380381c1a2 (patch) | |
| tree | 587baea34e7e8c7b56c087e9f8705c0f55a8970b /src | |
| parent | 517811764d3a37806f3e5c4f0c6ca6527e2c189c (diff) | |
| download | angular.js-84823b2eff21060c0883f6b4da5573380381c1a2.tar.bz2 | |
feature($exceptionHandler): $exceptionHandler now supports var_args
Diffstat (limited to 'src')
| -rw-r--r-- | src/angular-mocks.js | 8 | ||||
| -rw-r--r-- | src/service/exceptionHandler.js | 12 |
2 files changed, 14 insertions, 6 deletions
diff --git a/src/angular-mocks.js b/src/angular-mocks.js index 516259b8..0645322b 100644 --- a/src/angular-mocks.js +++ b/src/angular-mocks.js @@ -249,8 +249,12 @@ angular.mock.$ExceptionHandlerProvider = function() { case 'log': var errors = []; handler = function(e) { - errors.push(e); - }; + if (arguments.length == 1) { + errors.push(e); + } else { + errors.push([].slice.call(arguments, 0)); + } + } handler.errors = errors; break; default: diff --git a/src/service/exceptionHandler.js b/src/service/exceptionHandler.js index 6d680b04..26ea5845 100644 --- a/src/service/exceptionHandler.js +++ b/src/service/exceptionHandler.js @@ -10,13 +10,17 @@ * 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 overriden by + * 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(){ +function $ExceptionHandlerProvider() { this.$get = ['$log', function($log){ - return function(e) { - $log.error(e); + return function(exception, cause) { + $log.error.apply($log, arguments); }; }]; } |
