diff options
Diffstat (limited to 'src/lib/strings/errors.ts')
-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 } |