From a6ba0810b74c1c4c59a52036cf8f7c6cfd17526f Mon Sep 17 00:00:00 2001 From: Samuel Newman Date: Mon, 16 Feb 2026 21:09:49 +0000 Subject: [PATCH] Be more descriptive with video errors, log less (#9886) --- src/lib/strings/errors.ts | 1 + src/view/com/composer/state/video.ts | 19 +++++++++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/lib/strings/errors.ts b/src/lib/strings/errors.ts index e68cadeda2..4a5c9f09a9 100644 --- a/src/lib/strings/errors.ts +++ b/src/lib/strings/errors.ts @@ -54,6 +54,7 @@ const NETWORK_ERRORS = [ 'Failed to fetch', 'Load failed', 'Upstream service unreachable', + 'NetworkError when attempting to fetch resource', ] export function isNetworkError(e: unknown) { diff --git a/src/view/com/composer/state/video.ts b/src/view/com/composer/state/video.ts index 011bf42c69..05f57beefd 100644 --- a/src/view/com/composer/state/video.ts +++ b/src/view/com/composer/state/video.ts @@ -13,6 +13,7 @@ import { import {type CompressedVideo} from '#/lib/media/video/types' import {uploadVideo} from '#/lib/media/video/upload' import {createVideoAgent} from '#/lib/media/video/util' +import {isNetworkError} from '#/lib/strings/errors' import {logger} from '#/logger' type CaptionsTrack = {lang: string; file: File} @@ -403,7 +404,6 @@ function getUploadErrorMessage(e: unknown, _: I18n['_']): string | null { if (e instanceof AbortError) { return null } - logger.error('Error uploading video', {safeMessage: e}) if (e instanceof ServerError || e instanceof UploadLimitError) { // https://github.com/bluesky-social/tango/blob/lumi/lumi/worker/permissions.go#L77 switch (e.message) { @@ -433,9 +433,20 @@ function getUploadErrorMessage(e: unknown, _: I18n['_']): string | null { return _( msg`The selected video is larger than 100 MB. Please try again with a smaller file.`, ) - default: - return e.message + case 'Confirm your email address to upload videos': + return _(msg`Please confirm your email address to upload videos.`) } } - return _(msg`An error occurred while uploading the video.`) + + if (isNetworkError(e)) { + return _( + msg`An error occurred while uploading the video. Please check your internet connection and try again.`, + ) + } else { + // only log errors if they are unknown (and not network errors) + logger.error('Error uploading video', {safeMessage: e}) + } + + const message = e instanceof Error ? e.message : '' + return _(msg`An error occurred while uploading the video. ${message}`) }