diff --git a/CHANGELOG.md b/CHANGELOG.md index 979d6688..d83e4694 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -93,6 +93,7 @@ * [UIBULKED-351](https://issues.folio.org/browse/UIBULKED-351) Hide Query tab * [UIBULKED-276](https://issues.folio.org/browse/UIBULKED-276) Rename "Instance" column for holdings records preview * [UIBULKED-352](https://issues.folio.org/browse/UIBULKED-352) Localize numbers displayed in bulk edit +* [UIBULKED-210](https://issues.folio.org/browse/UIBULKED-210) Improve user errors for invalid data - IncorrectTokenCountException error. ## [3.0.5](https://github.com/folio-org/ui-bulk-edit/tree/v3.0.5) (2023-03-22) diff --git a/src/components/BulkEditList/BulkEditListSidebar/IdentifierTab/IdentifierTab.js b/src/components/BulkEditList/BulkEditListSidebar/IdentifierTab/IdentifierTab.js index d521f3b9..be43ab1c 100644 --- a/src/components/BulkEditList/BulkEditListSidebar/IdentifierTab/IdentifierTab.js +++ b/src/components/BulkEditList/BulkEditListSidebar/IdentifierTab/IdentifierTab.js @@ -15,6 +15,7 @@ import { ListSelect } from '../../../shared/ListSelect/ListSelect'; import { CRITERIA, EDITING_STEPS, + ERRORS, IDENTIFIER_FILTERS, JOB_STATUSES, TRANSLATION_SUFFIX @@ -133,11 +134,12 @@ export const IdentifierTab = () => { identifierType: recordIdentifier, }); - const { status } = await bulkOperationStart({ + const { status, errorMessage } = await bulkOperationStart({ id, step: EDITING_STEPS.UPLOAD, }); + if (errorMessage.includes(ERRORS.TOKEN)) throw Error(ERRORS.TOKEN); if (status === JOB_STATUSES.FAILED) throw Error(); history.replace({ @@ -147,10 +149,17 @@ export const IdentifierTab = () => { setIsFileUploaded(true); } catch ({ message }) { - showCallout({ - message: , - type: 'error', - }); + if (message === ERRORS.TOKEN) { + showCallout({ + message: , + type: 'error', + }); + } else { + showCallout({ + message: , + type: 'error', + }); + } } }; diff --git a/src/constants/core.js b/src/constants/core.js index aa94c241..35b35cd3 100644 --- a/src/constants/core.js +++ b/src/constants/core.js @@ -67,6 +67,10 @@ export const CRITERIA = { LOGS: 'logs', }; +export const ERRORS = { + TOKEN: 'Incorrect number of tokens found in record' +}; + export const TYPE_OF_PROGRESS = { INITIAL: 'initial', PROCESSED: 'processed', diff --git a/translations/ui-bulk-edit/en.json b/translations/ui-bulk-edit/en.json index 1b00e020..d0b57544 100644 --- a/translations/ui-bulk-edit/en.json +++ b/translations/ui-bulk-edit/en.json @@ -140,6 +140,7 @@ "error.uploadedFile": "Fail to upload file", "error.sww": "Something went wrong", + "error.incorrectFormatted": "{fileName}: is formatted incorrectly. Please correct the formatting and upload the file again.", "category.loanType": "Loan type", "category.location": "Location",