I have an XMLHttpRequest to an external service that sometimes answer with a "429 - Too many requests" response. I would like to avoid having the error logged in the Chrome console by catching or managing the response.
I've tried both adding an EventListener on "error"
function doNothing(e) {
return
}
var request = new XMLHttpRequest();
request.addEventListener('error', doNothing);
And try catching the request
try {
request.send(JSON.stringify(payload));
} catch(err){
// do nothing
}
But the log still appears