APP-2996: clean up Expo fetch network errors (#11611)
This commit is contained in:
@@ -86,6 +86,7 @@ const NETWORK_ERRORS = [
|
|||||||
'Abort',
|
'Abort',
|
||||||
'Network request failed',
|
'Network request failed',
|
||||||
'Failed to fetch',
|
'Failed to fetch',
|
||||||
|
'fetch failed',
|
||||||
'Load failed',
|
'Load failed',
|
||||||
'Upstream service unreachable',
|
'Upstream service unreachable',
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -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', () => {
|
it('surfaces the authentication-required code of a lex error', () => {
|
||||||
/*
|
/*
|
||||||
* The lex client derives `AuthenticationRequired` from a 401 with no XRPC
|
* The lex client derives `AuthenticationRequired` from a 401 with no XRPC
|
||||||
|
|||||||
@@ -83,6 +83,7 @@ const NETWORK_ERRORS = [
|
|||||||
'Abort',
|
'Abort',
|
||||||
'Network request failed',
|
'Network request failed',
|
||||||
'Failed to fetch',
|
'Failed to fetch',
|
||||||
|
'fetch failed',
|
||||||
'Load failed',
|
'Load failed',
|
||||||
'Upstream service unreachable',
|
'Upstream service unreachable',
|
||||||
'NetworkError when attempting to fetch resource',
|
'NetworkError when attempting to fetch resource',
|
||||||
|
|||||||
Reference in New Issue
Block a user