Handle "503 Service Unavailable" exception.
Bug: 1028799 No traceback, if service is unavailable; error out gracefully. * keystoneclient/exceptions.py ServiceUnavailable: New class to handle 503 status code. Add the new class to list of handled exceptions. Change-Id: I39a8ac594ef922d682731a926be26c8b6f648f9d
This commit is contained in:

committed by
Gerrit Code Review

parent
c784105148
commit
15d134d130
@@ -95,6 +95,14 @@ class HTTPNotImplemented(ClientException):
|
|||||||
message = "Not Implemented"
|
message = "Not Implemented"
|
||||||
|
|
||||||
|
|
||||||
|
class ServiceUnavailable(ClientException):
|
||||||
|
"""
|
||||||
|
HTTP 503 - Service Unavailable: The server is currently unavailable.
|
||||||
|
"""
|
||||||
|
http_status = 503
|
||||||
|
message = "Service Unavailable"
|
||||||
|
|
||||||
|
|
||||||
# In Python 2.4 Exception is old-style and thus doesn't have a __subclasses__()
|
# In Python 2.4 Exception is old-style and thus doesn't have a __subclasses__()
|
||||||
# so we can do this:
|
# so we can do this:
|
||||||
# _code_map = dict((c.http_status, c)
|
# _code_map = dict((c.http_status, c)
|
||||||
@@ -106,7 +114,8 @@ _code_map = dict((c.http_status, c) for c in [BadRequest,
|
|||||||
Forbidden,
|
Forbidden,
|
||||||
NotFound,
|
NotFound,
|
||||||
OverLimit,
|
OverLimit,
|
||||||
HTTPNotImplemented])
|
HTTPNotImplemented,
|
||||||
|
ServiceUnavailable])
|
||||||
|
|
||||||
|
|
||||||
def from_response(response, body):
|
def from_response(response, body):
|
||||||
|
Reference in New Issue
Block a user