Merge pull request #3176 from omnivore-app/fix/import-csv-error-message

Web: show more descriptive error message for csv uploading on home page
This commit is contained in:
Hongbo Wu 2023-11-28 15:10:19 +08:00 committed by GitHub
commit 3a6b11cf1e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -157,13 +157,22 @@ export function UploadModal(props: UploadModalProps): JSX.Element {
}
}
const result = await uploadImportFileRequestMutation(
UploadImportFileType.URL_LIST,
contentType
)
return {
uploadSignedUrl: result?.uploadSignedUrl,
message: `Importing ${urlCount} URLs`,
try {
const result = await uploadImportFileRequestMutation(
UploadImportFileType.URL_LIST,
contentType
)
return {
uploadSignedUrl: result?.uploadSignedUrl,
message: `Importing ${urlCount} URLs`,
}
} catch (error) {
console.log('caught error', error)
if (error == 'UPLOAD_DAILY_LIMIT_EXCEEDED') {
return {
message: 'You have exceeded your maximum daily upload limit.',
}
}
}
}
case 'application/zip': {