diff options
author | Vipin Balachandran <vbala@vmware.com> | 2015-06-15 17:36:02 +0530 |
---|---|---|
committer | Vipin Balachandran <vbala@vmware.com> | 2015-06-19 17:29:47 +0530 |
commit | 084f5475839a9742af74c24a8a2d6d5cf60f1da8 (patch) | |
tree | 3a8a9f41e925aa7ec8512a8b2d4b1c8e8642596e /oslo_vmware/api.py | |
parent | b7214cede59bbfaec640b3d1bd26daf25aab95f4 (diff) | |
download | oslo-vmware-084f5475839a9742af74c24a8a2d6d5cf60f1da8.tar.gz |
Exception hierarchy refactoring
There are two roots for the current exception hierarchy: VimException
and VMwareDriverException, which is not a good design. This patch
refactors the exception hierarchy to fix this problem.
Summary of changes:
* Change parent of VimException to VMwareDriverException
* Change parent of exceptions corresponding to known VIM faults
to VimException
* Change parent of VimSessionOverLoadException, VimConnectionException,
VimAttributeException and ImageTransferException to
VMwareDriverException.
The guidelines followed for this refactoring are:
* The changes in existing driver code should be NIL.
* The changes in other parts of the library should be minimal.
* Any exception raised by invocation of vim APIs should be a VimException
and any exception raised by pbm APIs should be a PbmException. But this
will result in lot of changes in the library as well as existing clients.
Therefore, we define a single root for these two types of exceptions which
is labeled as VimException.
* Any exception raised by the library should be a child of
VMwareDriverException. Therefore, VimException, VimSessionOverLoadException,
VimConnectionException, VimAttributeException and ImageTransferException
are children of VMwareDriverException. Ideally, VMwareDriverException
should be renamed as ServiceException, but it will result in backward
incompatibility.
Change-Id: Ide1bf891be78766e8670f8446792e3dc9c7ec88f
Diffstat (limited to 'oslo_vmware/api.py')
-rw-r--r-- | oslo_vmware/api.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/oslo_vmware/api.py b/oslo_vmware/api.py index df68bc9..58c3e8d 100644 --- a/oslo_vmware/api.py +++ b/oslo_vmware/api.py @@ -321,7 +321,8 @@ class VMwareAPISession(object): LOG.debug("Fault list: %s", excep.fault_list) fault = excep.fault_list[0] clazz = exceptions.get_fault_class(fault) - raise clazz(six.text_type(excep), excep.details) + raise clazz(six.text_type(excep), + details=excep.details) raise except exceptions.VimConnectionException: |