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

IOU Invalid Phone number error handled #8019

Merged
merged 5 commits into from
Mar 18, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/languages/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ export default {
error: {
invalidAmount: 'Invalid amount',
acceptedTerms: 'You must accept the Terms of Service to continue',
phoneNumber: 'Please enter a valid phone number, with the country code (e.g. +1234567890)',
},
please: 'Please',
contactUs: 'contact us',
Expand Down
3 changes: 2 additions & 1 deletion src/languages/es.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ export default {
error: {
invalidAmount: 'Monto no válido',
acceptedTerms: 'Debes aceptar los Términos de servicio para continuar',
phoneNumber: 'Ingresa un teléfono válido, incluyendo el código de país (p. ej. +1234567890)',
},
please: 'Por favor',
contactUs: 'contáctenos',
Expand Down Expand Up @@ -809,7 +810,7 @@ export default {
invite: {
invitePeople: 'Invitar nuevos miembros',
personalMessagePrompt: 'Agregar un mensaje personal (Opcional)',
pleaseSelectUser: 'Asegúrese de que el correo electrónico o el número de teléfono sean válidos (e.g. +15005550006).',
pleaseSelectUser: 'Asegúrese de que el correo electrónico o el número de teléfono sean válidos (p. ej. +15005550006).',
genericFailureMessage: 'Se produjo un error al invitar al usuario al espacio de trabajo. Vuelva a intentarlo..',
welcomeNote: ({workspaceName}) => `¡Has sido invitado a ${workspaceName}! Descargue la aplicación móvil Expensify en use.expensify.com/download para comenzar a rastrear sus gastos.`,
},
Expand Down
4 changes: 2 additions & 2 deletions src/libs/API.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,8 @@ Network.registerResponseHandler((queuedRequest, response) => {
return;
}

if (response.jsonCode === 405 || response.jsonCode === 404) {
// IOU Split & Request money transactions failed due to invalid amount(405) or unable to split(404)
if (response.jsonCode === 405 || response.jsonCode === 404 || response.jsonCode === 402) {
Copy link
Contributor

Choose a reason for hiding this comment

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

@Santhosh-Sellavel We must stop rejecting the promise here. ANY API command that returns this error code will lead to an unhandled promise rejection unless it is caught...

Copy link
Contributor

Choose a reason for hiding this comment

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

Fixing it in this PR #8087 already but got conflicts because the bad practice continues 😅

Copy link
Collaborator Author

@Santhosh-Sellavel Santhosh-Sellavel Mar 22, 2022

Choose a reason for hiding this comment

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

Sorry, I thought they were specific to this IOU Flow. Will keep a note on this @marcaaron.

// IOU Split & Request money transactions failed, due to invalid amount(405), unable to split(404), invalid phone number(402)
// It's a failure, so reject the queued request
queuedRequest.reject(response);
return;
Expand Down
2 changes: 2 additions & 0 deletions src/libs/actions/IOU.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ function getIOUErrorMessage(error) {
return Localize.translateLocal('common.error.invalidAmount');
} if (error.jsonCode === 404) {
return Localize.translateLocal('iou.error.invalidSplit');
} if (error.jsonCode === 402) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Put if statements on new lines please

return Localize.translateLocal('common.error.phoneNumber');
}
}
return Localize.translateLocal('iou.error.other');
Expand Down