Here is a snippet of code I am working with:
xhttp=new XMLHttpRequest();
xhttp.open("GET",doc_name,false);
xhttp.send();
xmlDoc=xhttp.responseXML;
if(xmlDoc==null)
{
xmlDoc=loadXMLDoc(defaultXml);
}
While this code functions properly by loading a default xml file if the specified file is not found, a 404 error appears only in the console. The error does not display anywhere else on the page.
My inquiry pertains to how I can handle this exception and whether it is necessary to include additional code to verify the existence of the file, especially when the current code works without it.