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

Handle error messages from services. #102

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from
Open

Handle error messages from services. #102

wants to merge 1 commit into from

Conversation

mohsin
Copy link

@mohsin mohsin commented Feb 5, 2022

This PR closes #101.

Details about the code in PR:

  • The 'removable_query_args' filter was added because Wordpress introduced a feature to remove certain parameters globally whenever present in URLs. Obviously, other services are going to return these parameters sometimes esp. error and message. So, this filter removes it for this plugin's admin UI to handle errors and show it to the user.
  • The keyring_handle_error_SERVICENAME filter allows services to handle their own error messages considering that errors are generally service/API-specific.
  • The action is set to services (in redirect_incoming_verify) to avoid it getting stuck in a redirect loop as that redirect handling code will keep getting triggered as long as error exists in the URL.
  • get_error_messages handles only 2 error codes since those were the ones I was able to reproduce (firstly in the issue I created and again during testing--the 1004 happens when user cancels, the 1006 one happens when either user cancels or the client secret is invalid ). I couldn't find any documentation that lists all the possible error codes (perhaps other APIs do and those could be added by other contributors).
  • On the same note as above, I found that Google does always sends error message as an underscored-slug text so I've humanized that and returned as a fallback error message that's better readable by a user.

* Displays any errors if the error parameter is set.
* Allows services to handle their own error messages via a keyring_handle_error_SERVICENAME filter.
@mohsin mohsin changed the title feat: Handle error messages from services. Handle error messages from services. Feb 5, 2022
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.

Error if I cancel during consent screen
1 participant