Merge "Treat HTTP code 400 and above as error."

This commit is contained in:
Jenkins
2013-02-07 19:33:19 +00:00
committed by Gerrit Code Review
2 changed files with 10 additions and 1 deletions

View File

@@ -341,7 +341,7 @@ class HTTPClient(object):
self.http_log_resp(resp) self.http_log_resp(resp)
if resp.status_code in (400, 401, 403, 404, 408, 409, 413, 500, 501): if resp.status_code >= 400:
_logger.debug( _logger.debug(
"Request returned failure status: %s", "Request returned failure status: %s",
resp.status_code) resp.status_code)

View File

@@ -79,6 +79,14 @@ class NotFound(ClientException):
message = "Not found" message = "Not found"
class MethodNotAllowed(ClientException):
"""
HTTP 405 - Method not allowed
"""
http_status = 405
message = "Method not allowed"
class Conflict(ClientException): class Conflict(ClientException):
""" """
HTTP 409 - Conflict HTTP 409 - Conflict
@@ -122,6 +130,7 @@ _code_map = dict((c.http_status, c) for c in [BadRequest,
Unauthorized, Unauthorized,
Forbidden, Forbidden,
NotFound, NotFound,
MethodNotAllowed,
OverLimit, OverLimit,
HTTPNotImplemented, HTTPNotImplemented,
ServiceUnavailable]) ServiceUnavailable])