View source Improve this doc

$exceptionHandlerProvider

service in module ngMock

Description

Configures the mock implementation of ng.$exceptionHandler to rethrow or to log errors passed into the $exceptionHandler.

Methods

  • mode(mode)

Sets the logging mode.

Parameters

ParamTypeDetailsmodestring

Mode of operation, defaults to rethrow.

  • rethrow: If any errors are passed into the handler in tests, it typically
  1. means that there is a bug in the application or test, so this mock will
  2. make these tests fail.
  • log: Sometimes it is desirable to test that an error is thrown, for this case the log
  1. mode stores an array of errors in `$exceptionHandler.errors`, to allow later
  2. assertion of them. See <a href="api/ngMock.$log#assertempty">assertEmpty()</a> and
  3. <a href="api/ngMock.$log#reset">reset()</a>