I've been trying to log the resources that are not getting success status codes (i.e 3xx,4xx & 5xx) in browser without depending on server's access logs. I came across performance.getEntries() , but it gives status codes only for http calls(XMLHttpRequest & Fetch) .
I also had tried instrumenting fetch in service workers , it worked but resulted in duplicate network calls being triggered ,
// Listen to fetch events
self.addEventListener('fetch', function(event) {
var promise = fetch(event.request.url);
event.respondWith(promise);
promise.then(function(data){
console.log(data);
})
});
Is there any way to instrument|intercept the browser requests for these resource files ?