Handle HTTP 400 errors somewhat more sanely.
Change-Id: I49c4225adfd552f0dd01c80cc3053ff2599eb47f
This commit is contained in:
parent
47c85147a5
commit
f99f313672
monikerclient
@ -31,6 +31,10 @@ class Unknown(RemoteError):
|
||||
pass
|
||||
|
||||
|
||||
class BadRequest(RemoteError):
|
||||
pass
|
||||
|
||||
|
||||
class Forbidden(RemoteError):
|
||||
pass
|
||||
|
||||
|
@ -74,7 +74,9 @@ class Client(object):
|
||||
"""
|
||||
response = func(*args, **kw)
|
||||
|
||||
if response.status_code in (401, 403):
|
||||
if response.status_code == 400:
|
||||
raise exceptions.BadRequest(response.json['errors'])
|
||||
elif response.status_code in (401, 403):
|
||||
raise exceptions.Forbidden()
|
||||
elif response.status_code == 404:
|
||||
raise exceptions.NotFound()
|
||||
|
Loading…
x
Reference in New Issue
Block a user