-
Notifications
You must be signed in to change notification settings - Fork 20
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
Conversation
Codecov Report
@@ 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
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
packages/server-settings/src/components/ServerSettingsView/index.tsx
Outdated
Show resolved
Hide resolved
packages/location-management/src/components/NewLocationUnit/index.tsx
Outdated
Show resolved
Hide resolved
@@ -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')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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')), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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'))) |
There was a problem hiding this comment.
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')) |
There was a problem hiding this comment.
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')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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'))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.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')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sendErrorNotification(t('There was a problem updating user')); | |
sendErrorNotification(t('There was a problem updating user profile')); |
Changes the error messages returned by failed request to messages with a bit more context of the source/cause of the error.
closes #1193