APP-2996: clean up Expo fetch network errors (#11611)

This commit is contained in:
Samuel Newman
2026-08-31 18:14:59 +03:00
committed by GitHub
parent 4495462f84
commit f32ebdec79
3 changed files with 11 additions and 0 deletions
+1
View File
@@ -86,6 +86,7 @@ const NETWORK_ERRORS = [
'Abort',
'Network request failed',
'Failed to fetch',
'fetch failed',
'Load failed',
'Upstream service unreachable',
]
+9
View File
@@ -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
+1
View File
@@ -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',