diff options
author | Hailey <me@haileyok.com> | 2024-09-25 15:05:33 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-25 15:05:33 -0700 |
commit | 58036ffb521032a77957b6888127bd640922eec6 (patch) | |
tree | c10e6698b3023aab53e717d29a9b93ef942b4019 /src/lib/strings | |
parent | b1ca2503de55c41431aac38db4d164da7d506d4f (diff) | |
download | voidsky-58036ffb521032a77957b6888127bd640922eec6.tar.zst |
Filter errors that get sent to Sentry (#5247)
Diffstat (limited to 'src/lib/strings')
-rw-r--r-- | src/lib/strings/errors.ts | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/lib/strings/errors.ts b/src/lib/strings/errors.ts index 899d8ebce..7d00c5e7f 100644 --- a/src/lib/strings/errors.ts +++ b/src/lib/strings/errors.ts @@ -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 } |