Unfortunately, there is no way to report an error in as much detail as possible. The reason is because JavaScript does not support this.
The HttpRequest object has the status and statusText (which you can get from your HttpRequestProgressEvent with evt.target , but those that represent HTTP status codes. Every other error has a status code of 0 - the request failed. This can be anything, and the only one the browser console is the place to view because it is an exception thrown by the browser.
If your request was synchronous, you could surround send() with try-catch. If your request is asynchronous, this will not work.
source share