Skip to content

Commit

Permalink
Merge pull request #33 from bunchesofdonald/master
Browse files Browse the repository at this point in the history
Added an OAuthException
  • Loading branch information
jgorset committed Apr 25, 2012
2 parents 33ecbe3 + c8a0bee commit 3a4d010
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions facepy/graph_api.py
Expand Up @@ -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)
)
Expand All @@ -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.