HTTPError should contain 'retry_after' parameter

'retry_after' may be passed as a parameter to create HTTPError
object, so add it to HTTPError parameter list.

Change-Id: Ia42b6b2e769ecd8cc2038a5a6384651cfa22c345
Closes-bug: #1524211
This commit is contained in:
Haiwei Xu 2015-12-09 17:24:17 +09:00
parent 3f12f9e562
commit 37548eed4f

View File

@ -69,7 +69,8 @@ class HttpError(base.ClientException):
def __init__(self, message=None, details=None, def __init__(self, message=None, details=None,
response=None, request_id=None, response=None, request_id=None,
url=None, method=None, http_status=None): url=None, method=None, http_status=None,
retry_after=0):
self.http_status = http_status or self.http_status self.http_status = http_status or self.http_status
self.message = message or self.message self.message = message or self.message
self.details = details self.details = details
@ -78,6 +79,7 @@ class HttpError(base.ClientException):
self.url = url self.url = url
self.method = method self.method = method
formatted_string = "%s (HTTP %s)" % (self.message, self.http_status) formatted_string = "%s (HTTP %s)" % (self.message, self.http_status)
self.retry_after = retry_after
if request_id: if request_id:
formatted_string += " (Request-ID: %s)" % request_id formatted_string += " (Request-ID: %s)" % request_id
super(HttpError, self).__init__(formatted_string) super(HttpError, self).__init__(formatted_string)