Account Settings: better error messaging for change email flow when address is already in use #9384
While logged into a WordPress.com account on the app, I try to update my email address to one that's used on a different WordPress.com account.
I get the error "Could not save your account settings".
Steps to reproduce the behavior
You'll need two WordPress.com accounts to test.
User report, Xiaomi Redmi Note 4X, WP Android 11.6 - #1855172-zen
referenced this issue
Mar 8, 2019
Note that if the email address change fails in this case, the API returns a nice error message we could use:
@rachelmcr I followed the logic of the solution in the PR that you posted. Since WordPress uses FluxC for handling network requests, it has a specific function for returning corresponding error messages. The problem is, since I'm using a development build (Oauth2), it's returning an error that my client is unauthorized to change the email (which might be true). So unless this fix is shipped in the production release, there's no way to verify if it's returning the correct error. Here's the screenshot:
Now here's a simpler solution, to just use another string that displays the appropriate code but there's no guarantee that all errors will be only because of invalid email:
Thanks for the update! Sorry for not catching earlier that this would be a tricky one to work on.
This is definitely the approach we want to take here, since there could be other reasons for a failed update (e.g. entering an invalid email address). Are you comfortable opening a PR to make that change despite not being able to verify the error message in your dev build? During the PR review, your reviewer can use the production keys to test the change and verify the message that's returned.
(And thank you for raising this here and in the WordPress Slack! It has sparked discussion among the release team about how this could be improved for anyone working on developing the apps.)