[Kimchi-devel] [PATCH v3 1/4] Add ResourceAlreadyExists Exception (HTTP 409)
Hongliang Wang
hlwang at linux.vnet.ibm.com
Mon Jun 16 02:20:16 UTC 2014
On 06/15/2014 07:18 PM, Aline Manera wrote:
> On 06/13/2014 06:16 AM, Hongliang Wang wrote:
>> When user tries to create a resource with an existing name, we should return
>> HTTP 409 status code to tell the user and let him/her choose another one.
>>
>> Signed-off-by: Hongliang Wang<hlwang at linux.vnet.ibm.com>
>> ---
>> src/kimchi/control/base.py | 2 ++
>> src/kimchi/exception.py | 4 ++++
>> 2 files changed, 6 insertions(+)
>>
>> diff --git a/src/kimchi/control/base.py b/src/kimchi/control/base.py
>> index f8a5210..a110ac2 100644
>> --- a/src/kimchi/control/base.py
>> +++ b/src/kimchi/control/base.py
>> @@ -276,6 +276,8 @@ class Collection(object):
>> raise cherrypy.HTTPError(400, e.message)
>> except NotFoundError, e:
>> raise cherrypy.HTTPError(404, e.message)
>> + except ResourceAlreadyExists, e:
>> + raise cherrypy.HTTPError(409, e.message)
>> except OperationFailed, e:
>> raise cherrypy.HTTPError(500, e.message)
>> except KimchiException, e:
>> diff --git a/src/kimchi/exception.py b/src/kimchi/exception.py
>> index fcf60cc..38daeab 100644
>> --- a/src/kimchi/exception.py
>> +++ b/src/kimchi/exception.py
>> @@ -91,3 +91,7 @@ class IsoFormatError(KimchiException):
>>
>> class TimeoutExpired(KimchiException):
>> pass
>> +
>> +
>> +class ResourceAlreadyExists(KimchiException):
>> + pass
>
> And let's keep using InvalidParameter for this proposal and if we get
> agreement 409 is better we change it for all the resources.
> That way we keep consistence between them.
ACK.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ovirt.org/pipermail/kimchi-devel/attachments/20140616/1e35183a/attachment.html>
More information about the Kimchi-devel
mailing list