docs(MockConnection) add mockError usage example (#8888)

This commit is contained in:
Phong Huynh 2016-05-27 13:10:53 -04:00 committed by Miško Hevery
parent b5d14c26d2
commit ec198b0dc6
1 changed files with 10 additions and 0 deletions

View File

@ -81,6 +81,16 @@ export class MockConnection implements Connection {
* Emits the provided error object as an error to the {@link Response} {@link EventEmitter}
* returned
* from {@link Http}.
*
* ### Example
*
* ```
* var connection;
* backend.connections.subscribe(c => connection = c);
* http.request('data.json').subscribe(res => res, err => console.log(err)));
* connection.mockError(new Error('error'));
* ```
*
*/
mockError(err?: Error) {
// Matches XHR semantics