From 1f4072911766a9e20c0f6f410c0927446316e84c Mon Sep 17 00:00:00 2001 From: Hongbo Wu Date: Mon, 27 Nov 2023 23:24:58 +0800 Subject: [PATCH] show more descriptive error message for csv uploading on home page --- .../web/components/templates/UploadModal.tsx | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/packages/web/components/templates/UploadModal.tsx b/packages/web/components/templates/UploadModal.tsx index 5c3919c17..bc1cc713b 100644 --- a/packages/web/components/templates/UploadModal.tsx +++ b/packages/web/components/templates/UploadModal.tsx @@ -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': {