ngMock.$exceptionHandlerProvider

Improve this Doc View Source $exceptionHandlerProvider

  1. $exceptionHandler
  2. provider in module ngMock

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

Methods

  • mode(mode);

    Sets the logging mode.

    Parameters

    Param Type Details
    mode string

    Mode of operation, defaults to rethrow.

    • rethrow: If any errors are passed into 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.
      
    • log: Sometimes it is desirable to test that an error is thrown, for this case the log
      mode stores an array of errors in `$exceptionHandler.errors`, to allow later
      assertion of them. See assertEmpty() and
      reset()
      

© 2010–2016 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://code.angularjs.org/1.2.32/docs/api/ngMock/provider/$exceptionHandlerProvider

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部