add error message for unsupported file

This commit is contained in:
smanylov
2026-03-03 13:25:26 +07:00
parent 2227a842ae
commit 3e3a5df34d
4 changed files with 27 additions and 7 deletions
+11 -2
View File
@@ -17,14 +17,23 @@ export async function searchUserFiles(fileId: string) {
if (parsed.message_code === 0) {
return parsed.message_body;
} else {
throw parsed;
throw parsed.message_desc;
}
} else {
throw (`${response.status}`);
}
} catch (error) {
return error
if (error === 'File for search unsupported') {
return {
errorMessage: 'file-for-search-unsupported'
}
} else {
return {
errorMessage: 'error'
}
}
}
}
+12 -3
View File
@@ -70,7 +70,11 @@ export function FileSearchPanel(
try {
let result = await searchUserFiles(fileId);
if (result.content.length) {
if (result.errorMessage) {
throw result.errorMessage
}
if (result?.content?.length) {
setSearchedUserFiles(result.content);
if (fileType === 'image') {
setShowGlobalSearch(true);
@@ -80,7 +84,12 @@ export function FileSearchPanel(
setSearchedUserFilesShowNull(true);
}
} catch (error) {
setErrorMessage('error');
if (error === 'file-for-search-unsupported') {
setErrorMessage(error);
} else {
setErrorMessage('search-error');
}
}
}, [fileId])
@@ -138,7 +147,7 @@ export function FileSearchPanel(
{errorMessage && (
<div className='mt-2 text-red-600 text-sm'>
{t('search-error')}
{t(errorMessage)}
</div>
)}
</div>
+2 -1
View File
@@ -286,7 +286,8 @@
"DIFFERENT": "DIFFERENT",
"file-information": "File information",
"id-in-the-system": "ID in the system",
"protection-status": "Protection status"
"protection-status": "Protection status",
"file-for-search-unsupported": "File for search unsupported"
},
"Login-register-form": {
"and": "and",
+2 -1
View File
@@ -286,7 +286,8 @@
"DIFFERENT": "ДРУГОЙ",
"file-information": "Информация о файле",
"id-in-the-system": "ID в системе",
"protection-status": "Статус защиты"
"protection-status": "Статус защиты",
"file-for-search-unsupported": "Файл для поиска не поддерживается"
},
"Login-register-form": {
"and": "и",