Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add intuitive messages for failed requests #1235

Merged
merged 8 commits into from
Jul 24, 2023

Conversation

mutuajames
Copy link
Contributor

@mutuajames mutuajames commented Jul 18, 2023

Changes the error messages returned by failed request to messages with a bit more context of the source/cause of the error.
closes #1193

@codecov-commenter
Copy link

codecov-commenter commented Jul 21, 2023

Codecov Report

Merging #1235 (cc359ac) into master (af1c901) will decrease coverage by 0.05%.
The diff coverage is 66.66%.

@@            Coverage Diff             @@
##           master    #1235      +/-   ##
==========================================
- Coverage   94.72%   94.67%   -0.05%     
==========================================
  Files         322      322              
  Lines        9454     9471      +17     
  Branches     2043     2052       +9     
==========================================
+ Hits         8955     8967      +12     
- Misses        491      496       +5     
  Partials        8        8              
Impacted Files Coverage Δ
...gement/src/components/CreateEditUserGroup/Form.tsx 98.03% <0.00%> (ø)
...ement/src/components/CreateEditUserGroup/index.tsx 97.05% <0.00%> (ø)
...-management/src/components/UserRolesList/index.tsx 92.30% <0.00%> (ø)
...management/src/components/forms/UserForm/index.tsx 92.15% <0.00%> (-3.77%) ⬇️
...nagement/src/components/EditLocationUnit/index.tsx 83.52% <0.00%> (ø)
...anagement/src/components/NewLocationUnit/index.tsx 72.54% <0.00%> (ø)
...-user-management/src/components/UserList/index.tsx 85.13% <20.00%> (ø)
...nventory/src/containers/InventoryAddEdit/index.tsx 93.82% <33.33%> (ø)
...management/src/components/UserGroupsList/index.tsx 88.09% <33.33%> (ø)
...nagement/src/components/LocationUnitList/index.tsx 91.22% <33.33%> (ø)
... and 37 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@@ -164,7 +164,7 @@ export const submitForm = async (
})
.catch((_: Error) => {
setSubmitting(false);
sendErrorNotification(t('An error occurred'));
sendErrorNotification(t('There was a problem submitting download client data form'));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
sendErrorNotification(t('There was a problem submitting download client data form'));
sendErrorNotification(t('There was a problem submitting data form'));

@@ -52,7 +52,7 @@ const CreateEditCareTeam: React.FC<CreateEditCareTeamProps> = (props: CreateEdit
[FHIR_CARE_TEAM, careTeamId],
async () => await new FHIRServiceClass(fhirBaseURL, FHIR_CARE_TEAM).read(careTeamId as string),
{
onError: () => sendErrorNotification(t('An error occurred')),
onError: () => sendErrorNotification(t('There was a problem fetching Care Team')),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
onError: () => sendErrorNotification(t('There was a problem fetching Care Team')),
onError: () => sendErrorNotification(t('There was a problem fetching the Care Team')),

@@ -165,7 +165,7 @@ const DrafFileList = (props: DraftFileListProps): JSX.Element => {
OPENSRP_MANIFEST_ENDPOINT,
dispatch,
customFetchOptions
).catch(() => sendErrorNotification(t('An error occurred')))
).catch(() => sendErrorNotification(t('There was a problem when making release')))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

refactor here to mean error while uploading the file.

@@ -233,7 +233,7 @@ const ManifestDraftFiles = (props: ManifestDraftFilesProps): JSX.Element => {
manifestEndPoint,
undefined,
getPayload
).catch(() => displayAlertError('An error occurred'))
).catch(() => displayAlertError('There was a problem when making release'))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

error while uploading the file

@@ -99,7 +99,11 @@ const UploadConfigFile = (props: UploadConfigFileProps & UploadDefaultProps) =>
displayAlertError,
endpoint
).catch(() => {
displayAlertError(t('An error occurred'));
if (isEditMode) {
displayAlertError(t('There was a problem updating file'));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
displayAlertError(t('There was a problem updating file'));
displayAlertError(t('There was a problem updating the file'));

@@ -133,7 +133,7 @@ const InventoryAddEdit: React.FC<InventoryAddEditProps> = (props: InventoryAddEd
setProducts(response);
})
.catch((_: HTTPError) => {
sendErrorNotification(t('An error occurred'));
sendErrorNotification(t('There was a problem fetching Product Catalogue'));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
sendErrorNotification(t('There was a problem fetching Product Catalogue'));
sendErrorNotification(t('There was a problem fetching the Product Catalogue'));

@@ -109,7 +109,7 @@ const CreateEditUserGroup: React.FC<CreateEditGroupPropTypes> = (
assignedRolesPromise,
effectiveRolesPromise,
])
.catch(() => sendErrorNotification(t('An error occurred')))
.catch(() => sendErrorNotification(t('There was a problem fetching group')))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.catch(() => sendErrorNotification(t('There was a problem fetching group')))
.catch(() => sendErrorNotification(t('There was a problem fetching user groups')))

.catch(() =>
sendErrorNotification(t('There was a problem fetching the location hierachy'))
);
else sendErrorNotification(t('There was a problem getting hierachy node'));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
else sendErrorNotification(t('There was a problem getting hierachy node'));
else sendErrorNotification(t('There was a problem finding the location'));

.catch(() => sendErrorNotification(t('An error occurred')));
else sendErrorNotification(t('An error occurred'));
.catch(() =>
sendErrorNotification(t('There was a problem fetching the location hierachy'))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
sendErrorNotification(t('There was a problem fetching the location hierachy'))
sendErrorNotification(t('An error occurred while refreshing location data.'))

@@ -192,7 +198,11 @@ export const submitForm = async (
updateGroupsAndPractitioner,
t
).catch(() => {
sendErrorNotification(t('An error occurred'));
if (isEditMode) {
sendErrorNotification(t('There was a problem updating user'));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
sendErrorNotification(t('There was a problem updating user'));
sendErrorNotification(t('There was a problem updating user profile'));

@peterMuriuki peterMuriuki merged commit 5cdaf3d into master Jul 24, 2023
2 checks passed
@peterMuriuki peterMuriuki deleted the 1193-custom-error-messages branch July 24, 2023 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FHIR Road Map]: Intuitive/intelligible error messages for failed requests.
3 participants