Fix a case where the 'aborted' error message was getting through
This commit is contained in:
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
export function isNetworkError(e: unknown) {
|
export function isNetworkError(e: unknown) {
|
||||||
const str = String(e)
|
const str = String(e)
|
||||||
return str.includes('Aborted') || str.includes('Network request failed')
|
return str.includes('Abort') || str.includes('Network request failed')
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,11 @@ import {useStores} from '../../../state'
|
|||||||
import * as apilib from '../../../state/lib/api'
|
import * as apilib from '../../../state/lib/api'
|
||||||
import {ComposerOpts} from '../../../state/models/shell-ui'
|
import {ComposerOpts} from '../../../state/models/shell-ui'
|
||||||
import {s, colors, gradients} from '../../lib/styles'
|
import {s, colors, gradients} from '../../lib/styles'
|
||||||
import {detectLinkables, extractEntities} from '../../../lib/strings'
|
import {
|
||||||
|
detectLinkables,
|
||||||
|
extractEntities,
|
||||||
|
cleanError,
|
||||||
|
} from '../../../lib/strings'
|
||||||
import {getLinkMeta} from '../../../lib/link-meta'
|
import {getLinkMeta} from '../../../lib/link-meta'
|
||||||
import {downloadAndResize} from '../../../lib/images'
|
import {downloadAndResize} from '../../../lib/images'
|
||||||
import {UserLocalPhotosModel} from '../../../state/models/user-local-photos'
|
import {UserLocalPhotosModel} from '../../../state/models/user-local-photos'
|
||||||
@@ -212,7 +216,7 @@ export const ComposePost = observer(function ComposePost({
|
|||||||
}
|
}
|
||||||
const onPaste = async (err: string | undefined, files: PastedFile[]) => {
|
const onPaste = async (err: string | undefined, files: PastedFile[]) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
return setError(err)
|
return setError(cleanError(err))
|
||||||
}
|
}
|
||||||
if (selectedPhotos.length >= 4) {
|
if (selectedPhotos.length >= 4) {
|
||||||
return
|
return
|
||||||
@@ -249,7 +253,7 @@ export const ComposePost = observer(function ComposePost({
|
|||||||
setProcessingState,
|
setProcessingState,
|
||||||
)
|
)
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
setError(e.message)
|
setError(cleanError(e.message))
|
||||||
setIsProcessing(false)
|
setIsProcessing(false)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user