Skip to content

Commit

Permalink
fix: test for skipped browser warnings early (#661)
Browse files Browse the repository at this point in the history
Some browser warning logs are skipped - moves the test for the skipable
warnings earlier in the method as they aren't skipped if valid message
args are extracted from the message.
  • Loading branch information
achingbrain committed May 7, 2024
1 parent 8c93214 commit f7248e9
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,17 @@ export async function redirectConsole(msg) {
return
}
const text = msg.text()

// skip browser informational warnings
if (
text?.includes(
'Synchronous XMLHttpRequest on the main thread is deprecated'
) ||
text?.includes('Clear-Site-Data')
) {
return
}

// const { url, lineNumber, columnNumber } = msg.location()
let msgArgs

Expand All @@ -274,14 +285,6 @@ export async function redirectConsole(msg) {
if (msgArgs && msgArgs.length > 0) {
consoleFn.apply(console, msgArgs)
} else if (text) {
if (
text.includes(
'Synchronous XMLHttpRequest on the main thread is deprecated'
) ||
text.includes('Clear-Site-Data')
) {
return
}
console.error(kleur.dim(`🌐${text}`))
}
}
Expand Down

0 comments on commit f7248e9

Please sign in to comment.