Add error code to APIException

Change-Id: I6663d5713d90651ee3623deafbcec3bde3eea506
Closes-bug: #1412486
This commit is contained in:
Tetiana Lashchova 2015-01-22 11:52:55 +02:00
parent 90b56a9f45
commit 7e80a0c41b

View File

@ -134,7 +134,8 @@ class ResourceManager(object):
error_data = get_json(resp).get("faultstring")
except ValueError:
error_data = resp.content
raise APIException(error_data)
raise APIException(error_code=resp.status_code,
error_message=error_data)
def get_json(response):
@ -152,4 +153,7 @@ def get_json(response):
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