remove stale isNetworkError copy from useCleanError
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
@@ -7,8 +7,8 @@ import {
|
||||
PUBLIC_APPVIEW,
|
||||
PUBLIC_APPVIEW_DID,
|
||||
} from '#/lib/constants'
|
||||
import {isNetworkError} from '#/lib/hooks/useCleanError'
|
||||
import {createLexClient} from '#/lib/lexClient'
|
||||
import {isNetworkError} from '#/lib/network-error'
|
||||
import {usePdsClient} from '#/state/session'
|
||||
import {usePatchAgeAssuranceServerState} from '#/ageAssurance'
|
||||
import {logger} from '#/ageAssurance/logger'
|
||||
|
||||
@@ -5,7 +5,8 @@ import {useLingui} from '@lingui/react'
|
||||
import {Trans} from '@lingui/react/macro'
|
||||
|
||||
import {wait} from '#/lib/async/wait'
|
||||
import {isNetworkError, useCleanError} from '#/lib/hooks/useCleanError'
|
||||
import {useCleanError} from '#/lib/hooks/useCleanError'
|
||||
import {isNetworkError} from '#/lib/network-error'
|
||||
import {logger} from '#/logger'
|
||||
import {atoms as a, useTheme, web} from '#/alf'
|
||||
import {Admonition} from '#/components/Admonition'
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import {useCallback} from 'react'
|
||||
import {useLingui} from '@lingui/react/macro'
|
||||
|
||||
import {isNetworkError} from '#/lib/network-error'
|
||||
|
||||
type CleanedError = {
|
||||
raw: string | undefined
|
||||
clean: string | undefined
|
||||
@@ -81,22 +83,3 @@ export function useCleanError() {
|
||||
[l],
|
||||
)
|
||||
}
|
||||
|
||||
const NETWORK_ERRORS = [
|
||||
'Abort',
|
||||
'Network request failed',
|
||||
'Failed to fetch',
|
||||
'fetch failed',
|
||||
'Load failed',
|
||||
'Upstream service unreachable',
|
||||
]
|
||||
|
||||
export function isNetworkError(e: unknown) {
|
||||
const str = String(e)
|
||||
for (const err of NETWORK_ERRORS) {
|
||||
if (str.includes(err)) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import {useNavigation} from '@react-navigation/native'
|
||||
import {type InfiniteData, useQueryClient} from '@tanstack/react-query'
|
||||
|
||||
import {useBottomBarOffset} from '#/lib/hooks/useBottomBarOffset'
|
||||
import {isNetworkError} from '#/lib/hooks/useCleanError'
|
||||
import {isNetworkError} from '#/lib/network-error'
|
||||
import {
|
||||
type CommonNavigatorParams,
|
||||
type NativeStackScreenProps,
|
||||
|
||||
Reference in New Issue
Block a user