diff --git a/apps/web/src/utils/logger.ts b/apps/web/src/utils/logger.ts index f0d481f..bd29d9e 100644 --- a/apps/web/src/utils/logger.ts +++ b/apps/web/src/utils/logger.ts @@ -49,6 +49,18 @@ const initialiseFrontendLogger = (): void => { ? argument : JSON.stringify(argument); }).join(" "); + + /* + * Ignore errors originating entirely from third-party scripts (e.g. AdSense). + * Stack frames from our own code reference elysium.nhcarrigan.com or localhost; + * if none are present but external URLs are, the error is not actionable. + */ + const hasExternalUrl = (/https?:\/\//u).test(message); + const hasOurDomain = message.includes("elysium.nhcarrigan.com"); + const hasOwnFrame = hasOurDomain || message.includes("localhost"); + if (hasExternalUrl && !hasOwnFrame) { + return; + } const context = "console.error"; post("/api/fe/error", { context, message }); };