Improve this Doc View Source $exceptionHandlerProvider
From Get docs
< Improve this Doc ngMock | providerAngularjs/docs/1.8/api/ngmock/provider/$exceptionhandlerprovider
Improve this Doc View Source $exceptionHandlerProvider
- $exceptionHandler
- provider in module ngMock
Overview
Configures the mock implementation of $exceptionHandler to rethrow or to log errors passed to the $exceptionHandler
.
Methods
- === mode(mode); ===
Sets the logging mode.
Parameters
Param Type Details mode string
Mode of operation, defaults to
rethrow
.log
: Sometimes it is desirable to test that an error is thrown, for this case thelog
mode stores an array of errors in$exceptionHandler.errors
, to allow later assertion of them. See assertEmpty() and reset().rethrow
: If any errors are passed to the handler in tests, it typically means that there is a bug in the application or test, so this mock will make these tests fail. For any implementations that expect exceptions to be thrown, therethrow
mode will also maintain a log of thrown errors in$exceptionHandler.errors
.
© 2010–2020 Google, Inc.
Licensed under the Creative Commons Attribution License 3.0.
https://code.angularjs.org/1.8.2/docs/api/ngMock/provider/$exceptionHandlerProvider