From 58036ffb521032a77957b6888127bd640922eec6 Mon Sep 17 00:00:00 2001 From: Hailey Date: Wed, 25 Sep 2024 15:05:33 -0700 Subject: Filter errors that get sent to Sentry (#5247) --- src/lib/strings/errors.ts | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'src/lib/strings/errors.ts') 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 } -- cgit 1.4.1