Add error code to APIException
Change-Id: I6663d5713d90651ee3623deafbcec3bde3eea506 Closes-bug: #1412486
This commit is contained in:
parent
90b56a9f45
commit
7e80a0c41b
@ -134,7 +134,8 @@ class ResourceManager(object):
|
|||||||
error_data = get_json(resp).get("faultstring")
|
error_data = get_json(resp).get("faultstring")
|
||||||
except ValueError:
|
except ValueError:
|
||||||
error_data = resp.content
|
error_data = resp.content
|
||||||
raise APIException(error_data)
|
raise APIException(error_code=resp.status_code,
|
||||||
|
error_message=error_data)
|
||||||
|
|
||||||
|
|
||||||
def get_json(response):
|
def get_json(response):
|
||||||
@ -152,4 +153,7 @@ def get_json(response):
|
|||||||
|
|
||||||
|
|
||||||
class APIException(Exception):
|
class APIException(Exception):
|
||||||
pass
|
def __init__(self, error_code=None, error_message=None):
|
||||||
|
super(APIException, self).__init__(error_message)
|
||||||
|
self.error_code = error_code
|
||||||
|
self.error_message = error_message
|
||||||
|
Loading…
Reference in New Issue
Block a user