diff --git a/aio/content/examples/http/src/testing/http-client.spec.ts b/aio/content/examples/http/src/testing/http-client.spec.ts index 2c5b5ffd46..e98bc7562e 100644 --- a/aio/content/examples/http/src/testing/http-client.spec.ts +++ b/aio/content/examples/http/src/testing/http-client.spec.ts @@ -150,7 +150,7 @@ describe('HttpClient testing', () => { // Create mock ErrorEvent, raised when something goes wrong at the network level. // Connection timeout, DNS error, offline, etc - const errorEvent = new ErrorEvent('so sad', { + const mockError = new ErrorEvent('Network error', { message: emsg, // #enddocregion network-error // The rest of this is optional and not used. @@ -162,7 +162,7 @@ describe('HttpClient testing', () => { }); // Respond with mock error - req.error(errorEvent); + req.error(mockError); }); // #enddocregion network-error diff --git a/aio/content/guide/http.md b/aio/content/guide/http.md index 502d914a6b..10dd3b6d43 100644 --- a/aio/content/guide/http.md +++ b/aio/content/guide/http.md @@ -1030,10 +1030,18 @@ you are responsible for flushing and verifying them. You should test the app's defenses against HTTP requests that fail. -Call `request.error()` with an `ErrorEvent` instead of `request.flush()`, as in this example. +Call `request.flush()` with an error message, as seen in the following example. + +Alternatively, you can call `request.error()` with an `ErrorEvent`. + + + \ No newline at end of file