XMLHttpRequest() & net::ERR_NAME_NOT_RESOLVED
After a great deal more research, I understand the problem more clearly, and understand the answer (No, it's not possible to get the reason - e.g., ERR_NAME_NOT_RESOLVED - in the error status).
This is by design. The Javascript error handling routines do not, and must not, return more information about the reason for the failures. Browsers do this to prevent malicious Javascript code from running port scanners on the local network and sending that information to a remote server.
This is borne out quite clearly by my report on the Chromium bug reporter and the response from one of the developers, at: https://bugs.chromium.org/p/chromium/issues/detail?id=718447 especially Comment #2.
Thus, the javascript in the window runs in a sandbox, that only has access to load, timeout, abort, and error status, without any further granularity. (The browser's debugging environment, though, can display this information, so you can figure out what went wrong...)
I had this issue this morning when I was trying to hit a server running on my local machine and I was able to resolve it by doing the following.
- Switch your request URL to
http://127.0.0.1:3000
- Make a network request with the new request URL
- Switch back to
http://localhost:3000
- Make another network request and it should work
I think it cleared some cache by forcing it to use the IP address directly. Hopefully, it works for others experiencing this issue.