-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Use more user friendly errors when choosing default fund for Wallet #7929
Changes from 12 commits
7f81c79
7596e3c
c1fcfe3
e468caf
6fde654
b31a27d
5bb9ffd
eb83cb6
4d14ac6
b8a61bc
4340851
42c161f
fe66a08
d1fdfa6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -109,12 +109,26 @@ function setWalletLinkedAccount(password, bankAccountID, fundID) { | |||||||||||||
walletLinkedAccountID: bankAccountID || fundID, walletLinkedAccountType: bankAccountID ? CONST.PAYMENT_METHODS.BANK_ACCOUNT : CONST.PAYMENT_METHODS.DEBIT_CARD, | ||||||||||||||
}); | ||||||||||||||
Growl.show(Localize.translateLocal('paymentsPage.setDefaultSuccess'), CONST.GROWL.SUCCESS, 5000); | ||||||||||||||
} else { | ||||||||||||||
Growl.show(Localize.translateLocal('paymentsPage.setDefaultFailure'), CONST.GROWL.ERROR, 5000); | ||||||||||||||
return; | ||||||||||||||
} | ||||||||||||||
Growl.show(Localize.translateLocal('paymentsPage.error.setDefaultFailure'), CONST.GROWL.ERROR, 5000); | ||||||||||||||
}).catch((error) => { | ||||||||||||||
// Make sure to show user more specific errors which will help support identify the problem faster. | ||||||||||||||
switch (error.message) { | ||||||||||||||
case CONST.WALLET.ERROR.INVALID_WALLET: | ||||||||||||||
case CONST.WALLET.ERROR.NOT_OWNER_OF_BANK_ACCOUNT: | ||||||||||||||
Growl.show(Localize.translateLocal('paymentsPage.error.notOwnerOfBankAccount') + " " + Localize.translateLocal('common.conciergeHelp'), CONST.GROWL.ERROR, 5000); | ||||||||||||||
return; | ||||||||||||||
case CONST.WALLET.ERROR.NOT_OWNER_OF_FUND: | ||||||||||||||
case CONST.WALLET.ERROR.INVALID_FUND: | ||||||||||||||
Growl.show(Localize.translateLocal('paymentsPage.error.notOwnerOfFund') + " " + Localize.translateLocal('common.conciergeHelp'), CONST.GROWL.ERROR, 5000); | ||||||||||||||
return; | ||||||||||||||
case CONST.WALLET.ERROR.INVALID_BANK_ACCOUNT: | ||||||||||||||
Growl.show(Localize.translateLocal('paymentsPage.error.invalidBankAccount') + " " + Localize.translateLocal('common.conciergeHelp'), CONST.GROWL.ERROR, 5000); | ||||||||||||||
return; | ||||||||||||||
default: | ||||||||||||||
Growl.show(Localize.translateLocal('paymentsPage.error.setDefaultFailure'), CONST.GROWL.ERROR, 5000); | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Anyone know if it's possible for this API command promise method to land in this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What exception is thrown and where? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh I think it's this weird code here that I am removing 😄 Lines 182 to 187 in c26e415
I think most errors do not work this way and There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is this one which we decided not to catch specifically as it should not happen but if it happens, the error message would need to be very general as the default already was. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes thanks I would like to know where the exception gets thrown in the JavaScript layer. This issue has more details: https://github.com/Expensify/Expensify/issues/201109 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh interesting, I have first tried to handle it in the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, thanks for the context! 🙌 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah it's because the promise is getting rejected which will trigger the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, that is weird indeed. We should standardize this for sure. |
||||||||||||||
} | ||||||||||||||
}) | ||||||||||||||
.catch(() => { | ||||||||||||||
Growl.show(Localize.translateLocal('paymentsPage.setDefaultFailure'), CONST.GROWL.ERROR, 5000); | ||||||||||||||
}); | ||||||||||||||
} | ||||||||||||||
|
||||||||||||||
|
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.
As per Ionatan suggestion, I have put the general
Please contact Concierge
message to separate translation so it can be reused. I have concatenated the two messages like this but I am not sure if there is a preference over doing this or using the `${foo} ${bar}` way.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.
Alright, linter has answered this for me by throwing an error :)