diff options
author | Paul Frazee <pfrazee@gmail.com> | 2022-12-05 13:25:04 -0600 |
---|---|---|
committer | Paul Frazee <pfrazee@gmail.com> | 2022-12-05 13:25:04 -0600 |
commit | f27e32e54c3e6a6f7d156cf6c23c11778a7dd316 (patch) | |
tree | 484dbd281d938082c0de8ec3ba346ed8af839429 /src/lib/strings.ts | |
parent | 59363181e1c72dcec3a86cf155f12a556e569b8f (diff) | |
download | voidsky-f27e32e54c3e6a6f7d156cf6c23c11778a7dd316.tar.zst |
Ensure the UI always renders, even in bad network conditions (close #6)
Diffstat (limited to 'src/lib/strings.ts')
-rw-r--r-- | src/lib/strings.ts | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/lib/strings.ts b/src/lib/strings.ts index 66dd59708..0474c330d 100644 --- a/src/lib/strings.ts +++ b/src/lib/strings.ts @@ -1,6 +1,7 @@ import {AtUri} from '../third-party/uri' import {Entity} from '../third-party/api/src/client/types/app/bsky/feed/post' import {PROD_SERVICE} from '../state' +import {isNetworkError} from './errors' import TLDs from 'tlds' export const MAX_DISPLAY_NAME = 64 @@ -201,7 +202,7 @@ export function enforceLen(str: string, len: number): string { } export function cleanError(str: string): string { - if (str.includes('Network request failed')) { + if (isNetworkError(str)) { return 'Unable to connect. Please check your internet connection and try again.' } if (str.startsWith('Error: ')) { |