From c205c277fa5d8af9bd43ed55138e2a0552fb3e55 Mon Sep 17 00:00:00 2001 From: David Medina Date: Sat, 12 Nov 2011 03:12:55 +0100 Subject: Catch unauthorized requests. Bad credentials --- github3/errors.py | 3 +++ github3/exceptions.py | 3 +-- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'github3') diff --git a/github3/errors.py b/github3/errors.py index bd85483..eed1e6c 100644 --- a/github3/errors.py +++ b/github3/errors.py @@ -21,6 +21,9 @@ class GithubError(object): 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')) diff --git a/github3/exceptions.py b/github3/exceptions.py index b0894a9..b033001 100644 --- a/github3/exceptions.py +++ b/github3/exceptions.py @@ -9,6 +9,5 @@ class UnprocessableEntity(Exception): pass class NotFound(Exception): pass -class AnomUser(Exception): - """ Exception for AnomUser handler """ +class Unauthorized(Exception): pass -- cgit v1.2.3-59-g8ed1b