diff options
author | 2011-12-03 20:07:07 +0100 | |
---|---|---|
committer | 2011-12-03 20:07:07 +0100 | |
commit | c1dad1ab5856e7e559cc2b2eaa7c8acb231981d1 (patch) | |
tree | f760a889eada0fe0d8cf8cadd8c19fa42c9b783b /github3/errors.py | |
parent | Fix bugs (diff) | |
parent | Complete AuthGist handler (diff) | |
download | python-github3-c1dad1ab5856e7e559cc2b2eaa7c8acb231981d1.tar.xz python-github3-c1dad1ab5856e7e559cc2b2eaa7c8acb231981d1.zip |
Merge branch 'develop'
Diffstat (limited to 'github3/errors.py')
-rw-r--r-- | github3/errors.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/github3/errors.py b/github3/errors.py index 09e616b..e96e2da 100644 --- a/github3/errors.py +++ b/github3/errors.py @@ -1,11 +1,10 @@ #!/usr/bin/env python # -*- encoding: utf-8 -*- -# -# author: David Medina import json import github3.exceptions as exceptions + class GithubError(object): """ Handler for API errors """ @@ -14,12 +13,15 @@ class GithubError(object): self.status_code = response.status_code try: self.debug = self._parser.loads(response.content) - except ValueError: + except (ValueError, TypeError): self.debug = {'message': response.content} def error_400(self): return exceptions.BadRequest("400 - %s" % self.debug.get('message')) + def error_401(self): + return exceptions.Unauthorized("401 - %s" % self.debug.get('message')) + def error_404(self): return exceptions.NotFound("404 - %s" % self.debug.get('message')) |