From 4404a0b0581ba226f6935f588649ce201a369d61 Mon Sep 17 00:00:00 2001 From: Megan Thomas Date: Tue, 25 Jun 2024 17:23:25 -0700 Subject: [PATCH] MWPW-143579 Log 404s to lana --- scripts/scripts.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/scripts.js b/scripts/scripts.js index 86f384d..7896f67 100644 --- a/scripts/scripts.js +++ b/scripts/scripts.js @@ -199,4 +199,10 @@ const miloLibs = setLibs(LIBS); if (document.querySelector('.faas')) { loadStyle('/styles/faas.css'); } + const observer = new PerformanceObserver((list) => { + list.getEntries().forEach((entry) => { + if (entry.responseStatus === 404) window.lana?.log(`The resource ${entry.name} returned a 404 status.`, { tags: 'errorType=error,module=resource-404' }); + }); + }); + observer.observe({ type: 'resource', buffered: true }); }());