If a fetch call fails in Chrome, then the only error details that I get back is
TypeError: Failed to fetch
How do I display an informative error message to the end user in this case?
Is it possible to get any details about why fetch failed?
As far as I can tell, the answer is no; I assume this is for security reasons, to avoid letting malicious JS find out which sites are and aren't accessible by inspecting error messages.
Is it possible to distinguish fetch errors from other
If I can't get error details, I'd like to at least replace the horribly vague "Failed to fetch" with an informative "Failed to access the web site; please try again later" message, and I'd like to do this without any risk of displaying that message for other
The only solution I've found here is to check the actual
to see if it's
"Failed to fetch"
. This is obviously browser-specific; it works in Chrome, it seems like it will work in any user language of Chrome, and other browsers would need their own testing and handling.