Skip to content

Instantly share code, notes, and snippets.

@avargas
Created February 7, 2017 21:12
Show Gist options
  • Save avargas/9327ddba545cf4fe47c371bd4d154b73 to your computer and use it in GitHub Desktop.
Save avargas/9327ddba545cf4fe47c371bd4d154b73 to your computer and use it in GitHub Desktop.
window error ignore
// filter out stupid error messags
(function () {
const prev = window.addEventListener;
const ignore = ['__gCrWeb.autofill.'];
window.addEventListener = function (a, b, c) {
if (a === 'error') {
return prev(a, function (err) {
// if error is matched to ignore list, ignore it then
if (err && err.message && ignore.filter(t => err.message.indexOf(t) > -1).length) {
return;
} else {
prev.apply(window, arguments);
}
}, c);
}
return prev.apply(window, arguments);
};
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment