jgorset/facepy — pull request #117 by tomwys (2014-07-10 18:48:22+00:00)
Title: Handle unknown statuses.

This is draft. I'm not sure about it's correctness.

Facepy have problems with handling unsuspected Facebook responses. It is showed in following code:
* https://github.com/jgorset/facepy/pull/115
* https://github.com/jgorset/facepy/pull/116
* https://github.com/jgorset/facepy/commit/39426bb1cb0efb1b2b254567f91e9ff12049c192

To handle this problem correctly status_code should be always checked and exception raised if we can't recognize returned status code.

In this way we will have elegant exception for new status codes, rather than random problems.

Exception class choice.
FacebookError is not good, because we don't now if it was error. HttpError is also not good, because Http did fine. I propose to use FacepyError, because problem lies in Facepy (we don't recognize, probably valid Facebook response).

Problem with this commit.
This commit is a draft. In fact I don't know if statuses added to tests (mostly 200) are in fact statuses returned by Facebook in real usege. For examples like "Too many requests in batch message. Maximum batch size is" i would expect different status from Facebook than 200.