Suppress Chrome 'Failed to load resource' messages in console Suppress Chrome 'Failed to load resource' messages in console google-chrome google-chrome

Suppress Chrome 'Failed to load resource' messages in console


This feature was introduced last year. You can enable it here: DevTools->Settings->General->Console->Hide network messages.

Hiding network messages in Chrome DevTools

See also Filtering the Console output and Additional settings in the devtools documentation.


Use console.clear() in the catch block or error handler function. It will clear those request error on the console immediately after it is logged.

PLEASE NOTE

From MDN

Note that in Google Chrome, console.clear() has no effect if the user has selected "Preserve log upon navigation" in the settings.

Read more about it on MDN

try {  var req = new XMLHttpRequest();  req.open('GET', 'https://invalidurl', false);  req.send();} catch(e) {  console.clear();}