diff options
author | 2011-11-05 20:47:14 +0100 | |
---|---|---|
committer | 2011-11-05 20:47:14 +0100 | |
commit | bdc593ac5ae97f4f9d65df15fcc18b632fae7666 (patch) | |
tree | 1e464c0753cc980153a57191b806cc42baadab71 /github3/errors.py | |
parent | Refactor base to handler design (diff) | |
download | python-github3-bdc593ac5ae97f4f9d65df15fcc18b632fae7666.tar.xz python-github3-bdc593ac5ae97f4f9d65df15fcc18b632fae7666.zip |
Fix litle bugs and args to request
Diffstat (limited to 'github3/errors.py')
-rw-r--r-- | github3/errors.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/github3/errors.py b/github3/errors.py index 6932360..96693be 100644 --- a/github3/errors.py +++ b/github3/errors.py @@ -12,12 +12,15 @@ class GithubError(object): def __init__(self, response): self._parser = json self.status_code = response.status_code - self.debug = self._parser.loads(response.content) + if response.content: + self.debug = self._parser.loads(response.content) + else: + self.debug = {} def error_400(self): return exceptions.BadRequest("400 - %s" % self.debug.get('message')) - def error_404(self) + def error_404(self): return exceptions.NotFound("404 - %s" % self.debug.get('message')) def error_422(self): |