aboutsummaryrefslogtreecommitdiffstats
path: root/pygithub3/core/errors.py
diff options
context:
space:
mode:
authorDavid Medina <davidmedina9@gmail.com>2012-02-06 21:39:59 +0100
committerDavid Medina <davidmedina9@gmail.com>2012-02-07 19:22:59 +0100
commit86453d2fb40e21280aeeee7e5ee11229bcb5eaac (patch)
tree2490c76fbbdef9bc14e5c1c2b83b632b1401eb2e /pygithub3/core/errors.py
parentSomething confusing about PUT request (diff)
downloadpython-github3-86453d2fb40e21280aeeee7e5ee11229bcb5eaac.tar.xz
python-github3-86453d2fb40e21280aeeee7e5ee11229bcb5eaac.zip
Clean requests interface
Refactorize on build request to support specific requests cleaner *Also support to verbose on requests library
Diffstat (limited to 'pygithub3/core/errors.py')
-rw-r--r--pygithub3/core/errors.py19
1 files changed, 6 insertions, 13 deletions
diff --git a/pygithub3/core/errors.py b/pygithub3/core/errors.py
index 1a9ed0c..ae7bcc4 100644
--- a/pygithub3/core/errors.py
+++ b/pygithub3/core/errors.py
@@ -1,19 +1,12 @@
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
-import json
+try:
+ import simplejson as json
+except ImportError:
+ import json
-
-class BadRequest(Exception):
- pass
-
-
-class UnprocessableEntity(Exception):
- pass
-
-
-class NotFound(Exception):
- pass
+from pygithub3.exceptions import NotFound, BadRequest, UnprocessableEntity
class GithubError(object):
@@ -34,7 +27,7 @@ class GithubError(object):
raise BadRequest("400 - %s" % self.debug.get('message'))
def error_422(self):
- errors = self.debug.get('errors')
+ errors = self.debug.get('errors', ())
errors = ['Resource: {resource}: {field} => {message} ({code})'.format(
**error)
for error in errors]