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

Update library/eden/facebook/post.php #8

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

Update library/eden/facebook/post.php #8

wants to merge 1 commit into from

Conversation

OptimusMarlboro
Copy link
Contributor

Throw exception if response contains error

Throw exception if response contains error
@cblanquera
Copy link
Member

We'll review this today. In all of our Web Service calls we are ignoring that there could be an error because in all cases they return with something more than the error message.

I resolve that we will store raw responses into a meta property that can be retrieved using getMeta(), from there we can freely throw errors.

@nikkobautista
Copy link
Contributor

@cblanquera That's a better way of handling it IMO. Do it this way:

  • execute the API call
  • store the results somewhere. if there is an error, instantiate an Error instance and store that
  • have a hasError() function which will check the API call results. If there is an error, it will return true. If none, it will return false
  • have a throwError() function to throw an Exeception
  • have a getError() function which will return an Error instance

This encapsulates all the error handling to each perspective API class, and provides a nice, clean and OO API for people to handle errors.

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.

3 participants