···54 'Failed to fetch',
55 'Load failed',
56 'Upstream service unreachable',
057]
5859export function isNetworkError(e: unknown) {
···54 'Failed to fetch',
55 'Load failed',
56 'Upstream service unreachable',
57+ 'NetworkError when attempting to fetch resource',
58]
5960export function isNetworkError(e: unknown) {
+15-4
src/view/com/composer/state/video.ts
···13import {type CompressedVideo} from '#/lib/media/video/types'
14import {uploadVideo} from '#/lib/media/video/upload'
15import {createVideoAgent} from '#/lib/media/video/util'
016import {logger} from '#/logger'
1718type CaptionsTrack = {lang: string; file: File}
···403 if (e instanceof AbortError) {
404 return null
405 }
406- logger.error('Error uploading video', {safeMessage: e})
407 if (e instanceof ServerError || e instanceof UploadLimitError) {
408 // https://github.com/bluesky-social/tango/blob/lumi/lumi/worker/permissions.go#L77
409 switch (e.message) {
···433 return _(
434 msg`The selected video is larger than 100 MB. Please try again with a smaller file.`,
435 )
436- default:
437- return e.message
438 }
439 }
440- return _(msg`An error occurred while uploading the video.`)
00000000000441}
···13import {type CompressedVideo} from '#/lib/media/video/types'
14import {uploadVideo} from '#/lib/media/video/upload'
15import {createVideoAgent} from '#/lib/media/video/util'
16+import {isNetworkError} from '#/lib/strings/errors'
17import {logger} from '#/logger'
1819type CaptionsTrack = {lang: string; file: File}
···404 if (e instanceof AbortError) {
405 return null
406 }
0407 if (e instanceof ServerError || e instanceof UploadLimitError) {
408 // https://github.com/bluesky-social/tango/blob/lumi/lumi/worker/permissions.go#L77
409 switch (e.message) {
···433 return _(
434 msg`The selected video is larger than 100 MB. Please try again with a smaller file.`,
435 )
436+ case 'Confirm your email address to upload videos':
437+ return _(msg`Please confirm your email address to upload videos.`)
438 }
439 }
440+441+ if (isNetworkError(e)) {
442+ return _(
443+ msg`An error occurred while uploading the video. Please check your internet connection and try again.`,
444+ )
445+ } else {
446+ // only log errors if they are unknown (and not network errors)
447+ logger.error('Error uploading video', {safeMessage: e})
448+ }
449+450+ const message = e instanceof Error ? e.message : ''
451+ return _(msg`An error occurred while uploading the video. ${message}`)
452}