···5454 'Failed to fetch',
5555 'Load failed',
5656 'Upstream service unreachable',
5757+ 'NetworkError when attempting to fetch resource',
5758]
58595960export function isNetworkError(e: unknown) {
+15-4
src/view/com/composer/state/video.ts
···1313import {type CompressedVideo} from '#/lib/media/video/types'
1414import {uploadVideo} from '#/lib/media/video/upload'
1515import {createVideoAgent} from '#/lib/media/video/util'
1616+import {isNetworkError} from '#/lib/strings/errors'
1617import {logger} from '#/logger'
17181819type CaptionsTrack = {lang: string; file: File}
···403404 if (e instanceof AbortError) {
404405 return null
405406 }
406406- logger.error('Error uploading video', {safeMessage: e})
407407 if (e instanceof ServerError || e instanceof UploadLimitError) {
408408 // https://github.com/bluesky-social/tango/blob/lumi/lumi/worker/permissions.go#L77
409409 switch (e.message) {
···433433 return _(
434434 msg`The selected video is larger than 100 MB. Please try again with a smaller file.`,
435435 )
436436- default:
437437- return e.message
436436+ case 'Confirm your email address to upload videos':
437437+ return _(msg`Please confirm your email address to upload videos.`)
438438 }
439439 }
440440- return _(msg`An error occurred while uploading the video.`)
440440+441441+ if (isNetworkError(e)) {
442442+ return _(
443443+ msg`An error occurred while uploading the video. Please check your internet connection and try again.`,
444444+ )
445445+ } else {
446446+ // only log errors if they are unknown (and not network errors)
447447+ logger.error('Error uploading video', {safeMessage: e})
448448+ }
449449+450450+ const message = e instanceof Error ? e.message : ''
451451+ return _(msg`An error occurred while uploading the video. ${message}`)
441452}