diff options
author | Gauvain Pocentek <gauvain@pocentek.net> | 2013-02-11 07:42:28 +0100 |
---|---|---|
committer | Gauvain Pocentek <gauvain@pocentek.net> | 2013-02-11 07:42:28 +0100 |
commit | 01152da8392e5fea16be7fa42a7320f95fd53ada (patch) | |
tree | d68de2a81b58a1299dd18fdd000b8475fca63c59 /gitlab.py | |
parent | c4920ee8ee91c27fa9603c36b4e98dfe5ec14244 (diff) | |
download | gitlab-01152da8392e5fea16be7fa42a7320f95fd53ada.tar.gz |
raise an exception on 401 return code
Diffstat (limited to 'gitlab.py')
-rw-r--r-- | gitlab.py | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -96,6 +96,8 @@ class Gitlab(object): for obj in l: obj.__dict__[k] = v return l + elif r.status_code == 401: + raise GitlabAuthenticationError(r.json['message']) else: raise GitlabGetError('%d: %s'%(r.status_code, r.text)) @@ -120,6 +122,8 @@ class Gitlab(object): for k,v in kwargs.items(): obj.__dict__[k] = v return obj + elif r.status_code == 401: + raise GitlabAuthenticationError(r.json['message']) else: raise GitlabGetError('%d: %s'%(r.status_code, r.text)) @@ -137,6 +141,8 @@ class Gitlab(object): if r.status_code == 200: return True + elif r.status_code == 401: + raise GitlabAuthenticationError(r.json['message']) return False def create(self, objClass, objData, **kwargs): @@ -156,6 +162,8 @@ class Gitlab(object): cls = objClass.returnClass return cls(self, r.json) + elif r.status_code == 401: + raise GitlabAuthenticationError(r.json['message']) else: raise GitlabCreateError('%d: %s'%(r.status_code, r.text)) @@ -176,6 +184,8 @@ class Gitlab(object): cls = objClass.returnClass return cls(self, r.json) + elif r.status_code == 401: + raise GitlabAuthenticationError(r.json['message']) else: raise GitlabUpdateError('%d: %s'%(r.status_code, r.text)) |