Correct reraising of exception

When an exception is caught and rethrown,
it should call 'raise' without any arguments
because it shows the place where an exception
occured initially instead of place where
the exception re-raised

Change-Id: I7e11d11ee07fcc6e149d1349e4aba9f86b890c49
Closes-Bug: #1616696
This commit is contained in:
gecong1973 2016-08-25 11:08:45 +08:00 committed by gecong
parent 06eabef61d
commit f11147078c
8 changed files with 16 additions and 16 deletions
manila
exception.py
share/drivers
hitachi/hnas
huawei/v3
netapp/dataontap/client
tegile
zfssa
manila_tempest_tests/tests/api

@ -89,7 +89,7 @@ class ManilaException(Exception):
try:
message = self.message % kwargs
except Exception as e:
except Exception:
# kwargs doesn't match a variable in the message
# log the issue and the kwargs
LOG.exception(_LE('Exception in string format operation.'))
@ -97,7 +97,7 @@ class ManilaException(Exception):
LOG.error(_LE("%(name)s: %(value)s"), {
'name': name, 'value': value})
if CONF.fatal_exception_format_errors:
raise e
raise
else:
# at least get the core message out if something happened
message = self.message

@ -254,7 +254,7 @@ class HNASSSHBackend(object):
else:
msg = six.text_type(e)
LOG.exception(msg)
raise e
raise
def create_directory(self, dest_path):
self._locked_selectfs('create', dest_path)
@ -282,7 +282,7 @@ class HNASSSHBackend(object):
if 'file system is already mounted' not in e.stderr:
msg = six.text_type(e)
LOG.exception(msg)
raise e
raise
def vvol_create(self, vvol_name):
# create a virtual-volume inside directory
@ -504,7 +504,7 @@ class HNASSSHBackend(object):
else:
msg = six.text_type(e)
LOG.exception(msg)
raise e
raise
class Export(object):

@ -216,7 +216,7 @@ class RestHelper(object):
except Exception as err:
LOG.error(_LE('Bad response from change file: %s.') % err)
raise err
raise
def _create_share(self, share_name, fs_id, share_proto):
"""Create a share."""

@ -332,7 +332,7 @@ class NetAppCmodeClient(client_base.NetAppBaseClient):
LOG.error(_LE("Volume %s is already offline."),
root_volume_name)
else:
raise e
raise
vserver_client.delete_volume(root_volume_name)
elif volumes_count > 1:
@ -925,7 +925,7 @@ class NetAppCmodeClient(client_base.NetAppBaseClient):
if e.code == netapp_api.EAPINOTFOUND:
return None
else:
raise e
raise
if len(aggrs) < 1:
return None
@ -2589,7 +2589,7 @@ class NetAppCmodeClient(client_base.NetAppBaseClient):
LOG.debug('Not connected to cluster management LIF.')
return False
else:
raise e
raise
@na_utils.trace
def create_cluster_peer(self, addresses, username=None, password=None,

@ -461,11 +461,11 @@ class TegileShareDriver(driver.ShareDriver):
data['qos'] = False
super(TegileShareDriver, self)._update_share_stats(data)
except Exception as e:
except Exception:
msg = _('Unexpected error while trying to get the '
'usage stats from array.')
LOG.exception(msg)
raise e
raise
@debugger
def get_pool(self, share):

@ -192,9 +192,9 @@ class RestClientURL(object): # pylint: disable=R0902
message=("REST Not Available:"
"Please Upgrade"))
except RestClientError as err:
except RestClientError:
del self.headers['authorization']
raise err
raise
def login(self, auth_str):
"""Login to an appliance using a user name and password.

@ -302,9 +302,9 @@ class ZFSSAShareDriver(driver.ShareDriver):
name = driver_options['zfssa_name']
try:
details = self._get_share_details(name)
except Exception as e:
except Exception:
LOG.error(_LE('Cannot manage share %s'), name)
raise e
raise
lcfg = self.configuration
input_export_loc = share['export_locations'][0]['path']

@ -498,7 +498,7 @@ class BaseSharesTest(test.BaseTestCase):
d["share"] = cls._create_share(
*d["args"], **d["kwargs"])
else:
raise e
raise
return [d["share"] for d in data]