Skip to content

Instantly share code, notes, and snippets.

@michaelhelmick
Created June 5, 2012 19:11
Show Gist options
  • Save michaelhelmick/2877078 to your computer and use it in GitHub Desktop.
Save michaelhelmick/2877078 to your computer and use it in GitHub Desktop.
except (facebook.GraphAPIError, DrundWorkerError, urllib2.HTTPError), e:
error = 'Unable to retrieve feed.'
if isinstance(e, urllib2.HTTPError):
try:
fb_error = json.loads(e.read())
error = fb_error['error']['message']
if fb_error['error']['type'] == 'OAuthException':
error += ' Please unauthorize Facebook via Settings > Manage Applications and then authenticate again.'
except ValueError:
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment