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:
parent
84d31fa55c
commit
dbdf06869b
1 changed files with 7 additions and 3 deletions
10
src/App.vue
10
src/App.vue
|
|
@ -87,15 +87,19 @@ window.onerror = (msg, url, line, col, error) => {
|
||||||
return suppressErrorAlert;
|
return suppressErrorAlert;
|
||||||
};
|
};
|
||||||
|
|
||||||
function isBrowserExtensionUnhandledRejection(reason) {
|
function isThirdPartyUnhandledRejection(reason) {
|
||||||
const stack = reason instanceof Error ? reason.stack : "";
|
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.
|
// Log Promise rejections that are never handled (.catch / await try/catch), e.g. fire-and-forget async.
|
||||||
window.addEventListener("unhandledrejection", (event) => {
|
window.addEventListener("unhandledrejection", (event) => {
|
||||||
const reason = event.reason;
|
const reason = event.reason;
|
||||||
if (isBrowserExtensionUnhandledRejection(reason)) {
|
if (isThirdPartyUnhandledRejection(reason)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue