28 lines
1.5 KiB
HTML
Executable file
28 lines
1.5 KiB
HTML
Executable file
<h1><code ng:non-bindable="">$exceptionHandlerProvider</code>
|
||
<span class="hint">(service in module <code ng:non-bindable="">ngMock</code>
|
||
)</span>
|
||
</h1>
|
||
<div><a href="http://github.com/angular/angular.js/edit/master/src/ngMock/angular-mocks.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
|
||
<div class="description"><p>Configures the mock implementation of <a href="api/ng.$exceptionHandler"><code>ng.$exceptionHandler</code></a> to rethrow or to log errors passed
|
||
into the <code>$exceptionHandler</code>.</p></div>
|
||
<div class="member method"><h2 id="Methods">Methods</h2>
|
||
<ul class="methods"><li><h3 id="mode">mode(mode)</h3>
|
||
<div class="mode"><p>Sets the logging mode.</p><h4 id="Parameters">Parameters</h4>
|
||
<ul class="parameters"><li><code ng:non-bindable="">mode – {string} – </code>
|
||
<p>Mode of operation, defaults to <code>rethrow</code>.</p>
|
||
|
||
<ul>
|
||
<li><code>rethrow</code>: If any errors are 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.</li>
|
||
<li><code>log</code>: Sometimes it is desirable to test that an error is thrown, for this case the <code>log</code> mode stores an
|
||
array of errors in <code>$exceptionHandler.errors</code>, to allow later assertion of them.
|
||
See <a href="api/ngMock.$log#assertEmpty">assertEmpty()</a> and
|
||
<a href="api/ngMock.$log#reset">reset()</a></li>
|
||
</ul></li>
|
||
</ul>
|
||
</div>
|
||
</li>
|
||
</ul>
|
||
</div>
|
||
</div>
|