[openstack-dev] [Neutron][LBaaS] DB layer - Specific exceptions when resource cant be found. Do they have any added value?
Avishay Balderman
AvishayB at Radware.com
Sun Jul 27 08:40:48 UTC 2014
The same applies for the ‘XInUse’ exception – we have specific exception for each entity that is ‘inUse’
Examples:
HealthMonitorInUse
PoolInUse
etc
I think that EnityInUse exception is good enough
Avishay
From: Avishay Balderman
Sent: Thursday, July 24, 2014 10:20 AM
To: OpenStack Development Mailing List (not for usage questions)
Subject: [openstack-dev] [Neutron][LBaaS] DB layer - Specific exceptions when resource cant be found. Do they have any added value?
Hi
In the LBaaS DB layer there is a utility method (‘_get_resource’) that takes entity type and the entity id and fetch it from DB.
If the entity can’t be found in DB the method throws a specific exception.
Example:
If we were looking for a Pool and it was not found in DB --> throw PoolNotFound
If we were looking for a HealthMonitor and it was not found in DB --> throw HealthMonitorNotFound
etc…
I can see very little value (if any…) in having those specific exceptions.
Why not have a base “NotFound” exception that gets the entity type and its id.
This exception will tell the method caller what is the entity type and its id. Isnt that good enough?
On the other hand this code should be mainlined and reviewed… So not only it has no value, the dev. team should maintain it.
Here is the code (v1) https://github.com/openstack/neutron/blob/master/neutron/db/loadbalancer/loadbalancer_db.py#L210
I prefer not to have it in v2
Thanks
Avishay
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20140727/fd2ac440/attachment.html>
More information about the OpenStack-dev
mailing list