display backend-driven upload failure messages (#11329)

This commit is contained in:
Spence Pope
2026-08-05 12:12:03 -04:00
committed by GitHub
parent 32ec5330b0
commit 8cb6c7babe
3 changed files with 101 additions and 23 deletions
+1 -1
View File
@@ -96,7 +96,7 @@
"prettier": "prettier --check ."
},
"dependencies": {
"@atproto/api": "0.20.34",
"@atproto/api": "0.20.37",
"@atproto/common-web": "0.5.6",
"@atproto/syntax": "0.7.2",
"@bitdrift/react-native": "^0.6.8",
+57 -18
View File
@@ -242,8 +242,8 @@ importers:
.:
dependencies:
'@atproto/api':
specifier: 0.20.34
version: 0.20.34
specifier: 0.20.37
version: 0.20.37
'@atproto/common-web':
specifier: 0.5.6
version: 0.5.6
@@ -871,32 +871,48 @@ packages:
graphql:
optional: true
'@atproto/api@0.20.34':
resolution: {integrity: sha512-nKfCLkH2Al58YupLGtoVIucZ5XjtN9sU5oOTI70lp8J4nxl52C/Tk7AktcWe+Nx7st3I0fUgf+C5cHePgvwT0w==}
'@atproto/api@0.20.37':
resolution: {integrity: sha512-TEt8oKMbuC+1GvqyLKDBLqmptnk1mh52FdHPQEomlPIWxh88YcNnk0g0iKNVBevaeeLtWZF1a7Am/t/q255u5Q==}
engines: {node: '>=22'}
'@atproto/common-web@0.5.6':
resolution: {integrity: sha512-5Y4MIK9dpkJPiKiE6u7iEHitxj+g3aAU2GfGL686JlKE2zDKD4y18BJb+uVek6nXQKb5XOdNVvw+7BHarpn8Fw==}
engines: {node: '>=22'}
'@atproto/common-web@0.5.8':
resolution: {integrity: sha512-GiYY2Jgbg1aWe9QGT3TswC/wZNicipBDz0nFo4FrP6XqENEJJRxGKAf/zjvqbesfIQFhHXi1VbSFY7GStB8v8w==}
engines: {node: '>=22'}
'@atproto/lex-data@0.1.5':
resolution: {integrity: sha512-TEM6GHuYpNm4O90LjNgbYq1Gmcr875S+BHrDxkg4PB5w/nlsz4HlbkGQG/WP/xbIV5O8TF5nNHDpCZ5ezTRrFA==}
engines: {node: '>=22'}
'@atproto/lex-data@0.1.7':
resolution: {integrity: sha512-kW/dPLqo/WgCLV+XESR4JKwV6c1rZWJGOfuPupZGTjEDAKoBbKXdaEzX9/1vKQYbZ9U3j0DS/n7OFFK7wBugyQ==}
engines: {node: '>=22'}
'@atproto/lex-json@0.1.4':
resolution: {integrity: sha512-ENR2cWkVrES+UL6TovbCRdX9BJOyHHJUS8jYx3Lxp3j4vEphjn/u+DW7bWloST2O8ID2OuVlt6+28ftNEEjmQQ==}
engines: {node: '>=22'}
'@atproto/lexicon@0.7.7':
resolution: {integrity: sha512-92VH2oEsJdrIVNy7WY8rGn99ANNVglyUffoN7GJc0mxKi+fXN5iVlJ2cOyTfYABhr2ldSiptZWXEPEdBaIR9/A==}
'@atproto/lex-json@0.1.6':
resolution: {integrity: sha512-mvrAd0lbyuecIHjyld8QN6MN6CBf4j0GCxLzegsvLh0SvDf+GbYWklkcQqmITL44yFQOwmA/QNIQj0Uvh7+R/g==}
engines: {node: '>=22'}
'@atproto/lexicon@0.7.10':
resolution: {integrity: sha512-HH/3d3z5Qt0JoJ9iOuLP/YT++6lb5wWMQsvgQ2TGfgkbuzDQ6AX6X1H5uJ9luPci4/LaADfpwLZfeqyy/Hjfaw==}
engines: {node: '>=22'}
'@atproto/syntax@0.7.2':
resolution: {integrity: sha512-tZ1Tr0R9pK4bI4Zs69t29cjMlCFQvRNBeNkqJC5pGeNuCt64D0eoF7s/AlqeVmYppClmQ0xJquggGgsMDP6j7w==}
engines: {node: '>=22'}
'@atproto/xrpc@0.8.6':
resolution: {integrity: sha512-yVfKrlwZBBm44Ft9jDvHcTCwQ1ElqSlzXHWhT/KcqE+u24EAhWVFosfABfGbUByB/PmN8eLJ06FsWo5pUQcMNQ==}
'@atproto/syntax@0.7.3':
resolution: {integrity: sha512-7LU8Ra79L5wCqVAZZst2352VMMwkU4KNagVMm6pnURrY/uS7+HrJl3XCuA4V2Gy2dEpkt1r6DBxlsP43/VjDBw==}
engines: {node: '>=22'}
'@atproto/xrpc@0.8.9':
resolution: {integrity: sha512-3jRiAuHCqYFoT8Nv25xFRmgrfmoo84yBnB5PfVP95JoRP+szIkwHS6mq72ZETYbWmLA1tNyR5QVEHrhHZ1LQhw==}
engines: {node: '>=22'}
'@babel/code-frame@7.10.4':
@@ -9389,12 +9405,12 @@ snapshots:
'@0no-co/graphql.web@1.2.0': {}
'@atproto/api@0.20.34':
'@atproto/api@0.20.37':
dependencies:
'@atproto/common-web': 0.5.6
'@atproto/lexicon': 0.7.7
'@atproto/syntax': 0.7.2
'@atproto/xrpc': 0.8.6
'@atproto/common-web': 0.5.8
'@atproto/lexicon': 0.7.10
'@atproto/syntax': 0.7.3
'@atproto/xrpc': 0.8.9
await-lock: 3.0.0
multiformats: 13.4.2
tlds: 1.261.0
@@ -9407,21 +9423,39 @@ snapshots:
'@atproto/syntax': 0.7.2
zod: 3.25.76
'@atproto/common-web@0.5.8':
dependencies:
'@atproto/lex-data': 0.1.7
'@atproto/lex-json': 0.1.6
'@atproto/syntax': 0.7.3
zod: 3.25.76
'@atproto/lex-data@0.1.5':
dependencies:
multiformats: 13.4.2
tslib: 2.8.1
unicode-segmenter: 0.14.5
'@atproto/lex-data@0.1.7':
dependencies:
multiformats: 13.4.2
tslib: 2.8.1
unicode-segmenter: 0.14.5
'@atproto/lex-json@0.1.4':
dependencies:
'@atproto/lex-data': 0.1.5
tslib: 2.8.1
'@atproto/lexicon@0.7.7':
'@atproto/lex-json@0.1.6':
dependencies:
'@atproto/common-web': 0.5.6
'@atproto/syntax': 0.7.2
'@atproto/lex-data': 0.1.7
tslib: 2.8.1
'@atproto/lexicon@0.7.10':
dependencies:
'@atproto/common-web': 0.5.8
'@atproto/syntax': 0.7.3
multiformats: 13.4.2
zod: 3.25.76
@@ -9430,9 +9464,14 @@ snapshots:
iso-datestring-validator: 2.2.2
tslib: 2.8.1
'@atproto/xrpc@0.8.6':
'@atproto/syntax@0.7.3':
dependencies:
'@atproto/lexicon': 0.7.7
iso-datestring-validator: 2.2.2
tslib: 2.8.1
'@atproto/xrpc@0.8.9':
dependencies:
'@atproto/lexicon': 0.7.10
zod: 3.25.76
'@babel/code-frame@7.10.4':
+43 -4
View File
@@ -388,7 +388,11 @@ export async function processVideo(
telemetry.processingFailed(e)
dispatch({
type: 'to_error',
error: getProcessingErrorMessage(status?.error, i18n),
error: getProcessingErrorMessage(
status?.failureCode,
status?.error,
i18n,
),
signal,
})
return // Exit async loop
@@ -421,7 +425,40 @@ export async function processVideo(
}
}
function getProcessingErrorMessage(error: string | undefined, i18n: I18n) {
function getProcessingErrorMessage(
failureCode: string | undefined,
error: string | undefined,
i18n: I18n,
) {
const validationError = getValidationErrorMessage(error, i18n)
if (failureCode === 'validation_failure') {
return (
validationError ?? i18n._(msg`The selected video could not be processed.`)
)
}
// Support workers deployed before failureCode was added.
if (!failureCode && validationError) {
return validationError
}
switch (failureCode) {
case 'encoding_failure':
return i18n._(msg`The selected video could not be encoded.`)
case 'pds_upload_failure':
return i18n._(
msg`The video could not be uploaded to your PDS. Please try again.`,
)
case 'pds_upload_unsupported_blob_size':
return i18n._(
msg`Your PDS does not support videos this large. Please try again with a smaller file.`,
)
case 'generic_failure':
default:
return i18n._(msg`Video failed to process`)
}
}
function getValidationErrorMessage(error: string | undefined, i18n: I18n) {
switch (error) {
case 'video_too_long':
return i18n._(msg`The selected video is too long.`)
@@ -429,8 +466,10 @@ function getProcessingErrorMessage(error: string | undefined, i18n: I18n) {
return i18n._(msg`The selected video has an unsupported aspect ratio.`)
case 'unsupported_codec':
return i18n._(msg`The selected video uses an unsupported format.`)
default:
return i18n._(msg`Video failed to process`)
case 'encoded_video_too_large':
return i18n._(
msg`The processed video is too large. Please try again with a smaller file.`,
)
}
}