-
Notifications
You must be signed in to change notification settings - Fork 27.1k
Description
📚 Docs or angular.io bug report
Description
A type was changed in a recent commit in angular which is not yet represented in the docs.
What's the affected URL?**
https://angular.io/guide/http#getting-error-details
Reproduction Steps**
In the code snippet app/config/config.service.ts there is this line:
if (error.error instanceof ErrorEvent)
In case of a network error (or similar like a CORS error) the error property of the HttpErrorResponse is should be according to the docs an ErrorEvent. But in my tests always seems to be a ProgressEvent.
In this recent commit
0139b11#diff-26683cfb34fa97883213282055aef1e7
in the file
packages/common/http/src/xhr.ts
the type of the error property of the returned HttpErrorResponse was changed from ErrorEvent to ProgressEvent.
Unfortunately unlike ErrorEvent the ProgressEvent has no message property. It is only usable as a indicator for a network error. The message property of the HttpErrorResponse itself has to be queried to retrieve a human readable error message.
The behaviour can be tested in
https://stackblitz.com/edit/error-handling-httpclient?file=src%2Fapp%2Fuser.service.ts
I am using Angular 8.2.14