I wanted to have in the console custom messages for fetch issues and thought that catching them would be enough:
fetch("https://thissitedoesnotexist.wazaa")
.then((response) => {
if (!response.ok) {
throw Error(response.status);
}
console.log("Result: ", response);
})
.catch((error) => {
console.log("Something went wrong: ", error.message)
});
What I get, however, are two console messages: one from the browser itself telling that the name is not resolved, and then my custom message:
Failed to load resource: net::ERR_NAME_NOT_RESOLVED
Something went wrong: Failed to fetch
Is there a way to discard the browser message?