Filter errors that get sent to Sentry (#5247)

This commit is contained in:
Hailey
2024-09-25 15:05:33 -07:00
committed by GitHub
parent b1ca2503de
commit 58036ffb52
4 changed files with 30 additions and 15 deletions
+13 -5
View File
@@ -20,11 +20,19 @@ export function cleanError(str: any): string {
return str
}
const NETWORK_ERRORS = [
'Abort',
'Network request failed',
'Failed to fetch',
'Load failed',
]
export function isNetworkError(e: unknown) {
const str = String(e)
return (
str.includes('Abort') ||
str.includes('Network request failed') ||
str.includes('Failed to fetch')
)
for (const err of NETWORK_ERRORS) {
if (str.includes(err)) {
return true
}
}
return false
}