Skip to content

Commit 4f9a66e

Browse files
feat: Added corrected grammer for the maxRecord exception (#1116)
2 parents f082516 + c8fb289 commit 4f9a66e

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

apps/api/src/app/shared/exceptions/max-records.exception.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ import { numberFormatter } from '@impler/shared';
33

44
export class MaxRecordsExceededException extends BadRequestException {
55
constructor({ maxAllowed, customMessage = null }: { maxAllowed: number; customMessage?: string }) {
6-
super(customMessage || `You can not import records more than ${numberFormatter(maxAllowed)} records.`);
6+
super(customMessage || `You can not import more than ${numberFormatter(maxAllowed)} records.`);
77
}
88
}

apps/widget/src/hooks/useCompleteImport.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { useMutation } from '@tanstack/react-query';
33
import { notifier } from '@util';
44
import { IUpload } from '@impler/client';
55
import { logAmplitudeEvent } from '@amplitude';
6-
import { IErrorObject } from '@impler/shared';
6+
import { IErrorObject, numberFormatter } from '@impler/shared';
77
import { useAppState } from '@store/app.context';
88
import { useAPIState } from '@store/api.context';
99

@@ -25,7 +25,7 @@ export const useCompleteImport = ({ onNext }: IUseCompleteImportProps) => {
2525
void,
2626
[string]
2727
// eslint-disable-next-line prettier/prettier
28-
>([`confirm:${uploadInfo._id}`], () => api.confirmReview(uploadInfo._id, maxRecords), {
28+
>([`confirm:${uploadInfo._id}`], () => api.confirmReview(uploadInfo._id, maxRecords), {
2929
onSuccess(uploadData) {
3030
logAmplitudeEvent('RECORDS', {
3131
type: 'invalid',
@@ -42,8 +42,11 @@ export const useCompleteImport = ({ onNext }: IUseCompleteImportProps) => {
4242
setUploadInfo(uploadData.uploadInfo);
4343
onNext?.(uploadData.uploadInfo, uploadData.importedData);
4444
},
45-
onError(error: IErrorObject) {
46-
notifier.showError({ message: texts.PHASE3.MAX_RECORD_LIMIT_ERROR ?? error.message, title: error.error });
45+
onError() {
46+
notifier.showError({
47+
message: `${texts.PHASE3.MAX_RECORD_LIMIT_ERROR} ${numberFormatter(Number(maxRecords))} records`,
48+
title: texts.PHASE3.MAX_RECORD_LIMIT_ERROR_TITLE,
49+
});
4750
},
4851
});
4952

packages/client/src/config/texts.config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@ export const WIDGET_TEXTS = {
109109
IN_COLUMN_LABEL: 'In Column',
110110
CASE_SENSITIVE_LABEL: 'Case Sensitive',
111111
MATCH_ENTIRE_LABEL: 'Match Entire Cell',
112-
MAX_RECORD_LIMIT_ERROR: 'You can not import records more than',
112+
MAX_RECORD_LIMIT_ERROR: 'You can not import more than',
113+
MAX_RECORD_LIMIT_ERROR_TITLE: 'Max Record Limit Error',
113114
},
114115
PHASE4: {
115116
TITLE: 'Bravo! {count} rows have been uploaded',

0 commit comments

Comments
 (0)