Permalink
Browse files

Merge pull request #33 from bunchesofdonald/master

Added an OAuthException
  • Loading branch information...
jgorset committed Apr 25, 2012
2 parents 33ecbe3 + c8a0bee commit 3a4d0107826fb7fe7ffab18919ad9fe8ecc96749
Showing with 10 additions and 2 deletions.
  1. +10 −2 facepy/graph_api.py
View
@@ -230,11 +230,16 @@ def _parse(self, data):
# We'll handle this discrepancy as gracefully as we can by implementing logic to deal with this behavior
# in the high-level access functions (get, post, delete etc.).
if type(data) is dict:
-
if 'error' in data:
error = data['error']
+ error_type = error.get('type')
- raise self.FacebookError(
+ if error_type == "OAuthException":
+ exception = self.OAuthException
+ else:
+ exception = self.FacebookError
+
+ raise exception(
error.get('message'),
error.get('code', None)
)
@@ -254,5 +259,8 @@ def __init__(self, message, code):
self.code = code
+ class OAuthException(FacebookError):
+ """ Exception for errors specifically related to OAuth. """
+
class HTTPError(FacepyError):
"""Exception for transport errors."""

0 comments on commit 3a4d010

Please sign in to comment.