Suppress Failed to load resource: net::ERR_FILE_NOT_FOUND in Chrome Packaged App
Yes, you can turn this off:
Click on the filter icon at the top of the console, and tick "Hide network messages".
You can't, however, prevent this error from happening at all: it's not generated by an uncaught exception in JS but is reported from the network stack of Chrome.
How to suppress Chrome DevTools warning: 'DevTools failed to load SourceMap: Could not load content for...'
In DevTools (F12) -> Settings (F1) :
Disable both "enable JS source maps" and "enable CSS source maps" in "Preferences -> Sources"
Bizarre Error in Chrome Developer Console - Failed to load resource: net::ERR_CACHE_MISS
Per the developers, this error is not an actual failure, but rather "misleading error reports". This bug is fixed in version 40, which is available on the canary and dev channels as of 25 Oct.
Patch
Can I prevent the Chrome Developer Tools console from logging image 404 errors?
Work has "started" on this by the Chromium team: https://code.google.com/p/chromium/issues/detail?id=96212
Update: The feature request was closed on March 18, 2013. I'm not sure in which version of Chrome this feature first appeared, but I can confirm console filtering options in my Chrome v33.0.1750.152 (Linux).
Update 2: Currently, when a filter (plain text or regular expression) is entered, it is tested against the message text (e.g. GET http://example.com/foobar 404 (Not Found)
) as well as the text of the right side link (e.g. test.html:65
). (I have filed an issue with Chromium to track this.)
As a workaround, use a regular expression filter like:
^(?!.* 404 \(Not Found\))(?!.*[file name])
where [file name]
is the file name from the right side link.
For example, if my page is test.html
, then ^(?!.* 404 \(Not Found\))(?!.*test\.html)
will work.
Note: This will also filter out messages that have the file name in the message text. I'm not sure there is a way around this for now.
Update (2019-06-05): This expression will filter out 404s in my current version of Chrome (75.0.3770.80):
-/404\s\(Not\sFound\)$/
It seems the filtering first splits the filter string by whitespace before processing each token, but it will also split spaces inside of a regular expression, so the \s
's are necessary.
Technically, this will filter out any message ending with the (case insensitive) string "404 (Not Found)", including console.log
messages.
How do I handle network errors so they don't appear in chrome developer console?
Following the links from a bug @wOxOm posted, I came across a helpful comment:
In Chrome you can click the Filter icon then "Hide network messages".
Whilst it's a bit heavier handed than I'd have liked (as it applies to all network traffic on the current page), it seems to be the best way to achieve what I'm looking for in the current version of Chrome.
Handling Chrome console errors in JavaScript (XMLHttpRequest)
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.
Related Topics
Settimeout Calls Function Immediately Instead of After Delay
How to Simulate a Click With JavaScript
How to Get the Youtube Video Id from a Url
Is It Not Possible to Stringify an Error Using Json.Stringify
Performance of CSS Transitions VS. Js Animation Packages
Polymer Share Styles Across Elements
Convert Dropdown to Selection Boxes with Color and Trigger Drop Down Action
Viable Options for Running Nodejs on Android (Aug 2017)
Is There a JavaScript Function That Can Pad a String to Get to a Determined Length
Count the Number of Occurrences of a Character in a String in JavaScript
How to Check For a #Hash in a Url Using JavaScript
Angularjs Routing Without the Hash '#'
Fastest Method to Replace All Instances of a Character in a String