Exclude quantummetric caused errors from logging unhandled rejection

Add quantummetric.com to the exclusion of unhandled rejection logging similar to browser extensions
This commit is contained in:
Matt Sykes 2026-06-25 12:57:29 -04:00
parent 84d31fa55c
commit dbdf06869b

View file

@ -87,15 +87,19 @@ window.onerror = (msg, url, line, col, error) => {
return suppressErrorAlert;
};
function isBrowserExtensionUnhandledRejection(reason) {
function isThirdPartyUnhandledRejection(reason) {
const stack = reason instanceof Error ? reason.stack : "";
return typeof stack === "string" && stack.includes("chrome-extension://");
if (typeof stack !== "string") {
return false;
}
return stack.includes("chrome-extension://") || stack.includes("quantummetric.com");
}
// Log Promise rejections that are never handled (.catch / await try/catch), e.g. fire-and-forget async.
window.addEventListener("unhandledrejection", (event) => {
const reason = event.reason;
if (isBrowserExtensionUnhandledRejection(reason)) {
if (isThirdPartyUnhandledRejection(reason)) {
return;
}