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

Not easy to determinate Facebook.request(...) errors #11

Closed
Korriged opened this issue Jun 2, 2010 · 2 comments
Closed

Not easy to determinate Facebook.request(...) errors #11

Korriged opened this issue Jun 2, 2010 · 2 comments

Comments

@Korriged
Copy link

Korriged commented Jun 2, 2010

Facebook.request(...) returns a String... not easy to determinate which type of error it is.

We have to parse the string to check if it contains: - "< HTML >", what means it is an HTTP error;
- "error_code" or "error", what means it is a Facebook error (JSON string).
Otherwise it is not an error and the string contains the id of the publication.

-> could Facebook.request(...) return an object instead of a string?
Thanks :)

@soneff
Copy link

soneff commented Jun 2, 2010

Try using the Utils.parseJson() method: it will create a JSONObject from the response, or throw an exception is if the response is not JSON or contains an error.

In designing the SDK, we opted to give developers maximum flexibility by returning the string representation of the request response, rather than some Object representation; in this way, the application can parse the string as it sees fit.

@Korriged
Copy link
Author

Korriged commented Jun 2, 2010

OK if this is your choice...

I am going to see how I can manage that...

Thanks for your answer :)

This issue was closed.
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

No branches or pull requests

2 participants