So for over three days, I'm keep searching on how to get this error hidden from the console and respond to this error:
Failed to load resource: net::ERR_NAME_NOT_RESOLVED
Error image in the Google Chrome's console, that I want to hide and handle
Neither official chrome documentation helps. https://developers.google.com/web/tools/chrome-devtools/console/track-exceptions
Nor any tricks that I came along on the google search.
(For quick testing of the handling solution)
<!DOCTYPE html>
<html lang="en">
<head>
<title></title>
</head>
<body>
information: <div id="information" ></div>
<script>
var httpRequest = new XMLHttpRequest();
httpRequest.open("GET", "https://sdajfkljsdfk.lt", true);
httpRequest.onload = function (e) {
if (httpRequest.readyState === 4) {
if (httpRequest.status === 200) {
console.log(httpRequest.responseText);
} else {
document.getElementById("information").innerHTML = "Error Unresponsive Domain";
}
}
};
httpRequest.send(null);
</script>
</body>
</html>
Try doing this
httpRequest.open("GET", "https://sdajfkljsdfk.lt", true);
httpRequest.onload = function (e) {
if (httpRequest.readyState === 4) {
if (httpRequest.status === 200) {
console.log(httpRequest.responseText);
} else {
document.getElementById("information").innerHTML = "Error Unresponsive Domain";
}
}
};
httpRequest.onerror = function (e) {
document.getElementById("information").innerHTML = "Error Unresponsive Domain";
};
httpRequest.send(null);
Also you can take a look at this link if my answer is not clear enough. This one too
UPDATE
You're not going to be able to delete one specific error from the console. Only way to clear it is to try something like this:
httpRequest.onerror = function (e) {
document.getElementById("information").innerHTML = "Error Unresponsive Domain";
console.clear(); //clear console
};
httpRequest.send(null);
I also stumbled upon this but I don't know if it will help you.