From 02dbe474a3091128c5a0b3944c1d3e1ac3ea2f75 Mon Sep 17 00:00:00 2001 From: aniket Date: Mon, 18 Nov 2024 18:01:16 +0000 Subject: [PATCH 1/3] Fix error message on invalid file type import --- mathesar_ui/src/api/rest/utils/requestUtils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mathesar_ui/src/api/rest/utils/requestUtils.ts b/mathesar_ui/src/api/rest/utils/requestUtils.ts index 1df260a756..bda2c32754 100644 --- a/mathesar_ui/src/api/rest/utils/requestUtils.ts +++ b/mathesar_ui/src/api/rest/utils/requestUtils.ts @@ -225,7 +225,7 @@ export function uploadFile( resolve(request.response as T); } } else { - reject(new Error('An error has occurred while uploading a file.')); + reject(new Error('Uploaded file type is not supported. Please upload CSV/TSV/JSON files')); } }); }, From 0fc1aca0d1c13864b594e4edb87ef56428d72c40 Mon Sep 17 00:00:00 2001 From: aniket Date: Tue, 19 Nov 2024 11:42:56 +0000 Subject: [PATCH 2/3] Refactored the error message --- mathesar_ui/src/api/rest/utils/requestUtils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mathesar_ui/src/api/rest/utils/requestUtils.ts b/mathesar_ui/src/api/rest/utils/requestUtils.ts index bda2c32754..66090b0569 100644 --- a/mathesar_ui/src/api/rest/utils/requestUtils.ts +++ b/mathesar_ui/src/api/rest/utils/requestUtils.ts @@ -225,7 +225,7 @@ export function uploadFile( resolve(request.response as T); } } else { - reject(new Error('Uploaded file type is not supported. Please upload CSV/TSV/JSON files')); + reject(new Error('An error occurred while processing the file. Supported file types are CSV and TSV.')); } }); }, From 20c363c1d6b1bf0e8335bc1ce7bb08c6f2d895eb Mon Sep 17 00:00:00 2001 From: Brent Moran Date: Thu, 21 Nov 2024 07:59:24 +0800 Subject: [PATCH 3/3] fix linter error --- mathesar_ui/src/api/rest/utils/requestUtils.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mathesar_ui/src/api/rest/utils/requestUtils.ts b/mathesar_ui/src/api/rest/utils/requestUtils.ts index 66090b0569..bce70879ae 100644 --- a/mathesar_ui/src/api/rest/utils/requestUtils.ts +++ b/mathesar_ui/src/api/rest/utils/requestUtils.ts @@ -225,7 +225,11 @@ export function uploadFile( resolve(request.response as T); } } else { - reject(new Error('An error occurred while processing the file. Supported file types are CSV and TSV.')); + const msg = [ + 'An error occurred while processing the file.', + 'Supported file types are CSV and TSV.', + ].join(' '); + reject(new Error(msg)); } }); },