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

Prevent a fatal error when API request fails #163

Merged
merged 1 commit into from
Jun 12, 2020

Conversation

dkotter
Copy link

@dkotter dkotter commented Apr 1, 2020

Description of the Change

We had an issue where API credentials were revoked and it caused a fatal error on our site. This error originated in the code that gets a list of all available players. The request to get the players will fail and we have a is_wp_error check on that but we don't check for that until after we try and use the returned value (which causes fatals if that value is an error).

This PR moves that check up prior to us trying to use that value and also adds a check to ensure the returned value isn't false.

Alternate Designs

None

Benefits

Prevent fatal errors if API credentials are revoked.

Possible Drawbacks

None

Verification Process

This fix was pushed into our staging environment that was experiencing the fatal errors and this resolved those

Checklist:

  • I have read the CONTRIBUTING document.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests passed.

@oscarssanchez
Copy link
Contributor

Hi @dkotter, I will bring this one on our Monthly meeting with Brightcove

@oscarssanchez oscarssanchez merged commit ac28477 into develop Jun 12, 2020
@jeffpaul jeffpaul added this to the 1.9.2 milestone Jun 29, 2020
@jeffpaul jeffpaul deleted the fix/proper-error-checking branch September 7, 2021 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants