diff --git a/src/lib/hooks/useCleanError.ts b/src/lib/hooks/useCleanError.ts index 5f8dce6081..6af36536df 100644 --- a/src/lib/hooks/useCleanError.ts +++ b/src/lib/hooks/useCleanError.ts @@ -86,6 +86,7 @@ const NETWORK_ERRORS = [ 'Abort', 'Network request failed', 'Failed to fetch', + 'fetch failed', 'Load failed', 'Upstream service unreachable', ] diff --git a/src/lib/strings/__tests__/errors.test.ts b/src/lib/strings/__tests__/errors.test.ts index 703cc955fb..e53a877a4a 100644 --- a/src/lib/strings/__tests__/errors.test.ts +++ b/src/lib/strings/__tests__/errors.test.ts @@ -91,6 +91,15 @@ describe('cleanError', () => { ) }) + it('matches Expo fetch network errors', () => { + const e = new Error( + 'Unexpected fetchHandler() error: fetch failed: UnexpectedException: The network connection was lost. (at ExpoModulesCore/Promise.swift:56)', + ) + expect(cleanError(e)).toBe( + 'Unable to connect. Please check your internet connection and try again.', + ) + }) + it('surfaces the authentication-required code of a lex error', () => { /* * The lex client derives `AuthenticationRequired` from a 401 with no XRPC diff --git a/src/lib/strings/errors.ts b/src/lib/strings/errors.ts index 365a069e2d..dc3f667efa 100644 --- a/src/lib/strings/errors.ts +++ b/src/lib/strings/errors.ts @@ -83,6 +83,7 @@ const NETWORK_ERRORS = [ 'Abort', 'Network request failed', 'Failed to fetch', + 'fetch failed', 'Load failed', 'Upstream service unreachable', 'NetworkError when attempting to fetch resource',