diff --git a/novaclient/exceptions.py b/novaclient/exceptions.py index b331c3c01..afea93326 100644 --- a/novaclient/exceptions.py +++ b/novaclient/exceptions.py @@ -116,6 +116,22 @@ class NotFound(ClientException): message = "Not found" +class MethodNotAllowed(ClientException): + """ + HTTP 405 - Method Not Allowed + """ + http_status = 405 + message = "Method Not Allowed" + + +class Conflict(ClientException): + """ + HTTP 409 - Conflict + """ + http_status = 409 + message = "Conflict" + + class OverLimit(ClientException): """ HTTP 413 - Over limit: you're over the API limits for this time period. @@ -147,8 +163,9 @@ class HTTPNotImplemented(ClientException): # for c in ClientException.__subclasses__()) # # Instead, we have to hardcode it: -_code_map = dict((c.http_status, c) for c in [BadRequest, Unauthorized, - Forbidden, NotFound, OverLimit, HTTPNotImplemented]) +_error_classes = [BadRequest, Unauthorized, Forbidden, NotFound, + MethodNotAllowed, Conflict, OverLimit, HTTPNotImplemented] +_code_map = dict((c.http_status, c) for c in _error_classes) def from_response(response, body, url, method=None):