Keep Trace Back in Exception

While catching exception, we should use 'raise' directly if we parsing
same exception to upper level. In this way, we will not losing trace
back information.

Change-Id: I9cb208bb355082907b789dffa8de28dd33c9f01d
This commit is contained in:
ricolin 2016-05-31 00:28:52 +08:00
parent 5b2bcd8b2e
commit 74d3131415
6 changed files with 7 additions and 7 deletions

View File

@ -62,7 +62,7 @@ class BarbicanClientPlugin(client_plugin.ClientPlugin):
raise exception.EntityNotFound( raise exception.EntityNotFound(
entity="Secret", entity="Secret",
name=secret_ref) name=secret_ref)
raise ex raise
def get_container_by_ref(self, container_ref): def get_container_by_ref(self, container_ref):
try: try:
@ -73,7 +73,7 @@ class BarbicanClientPlugin(client_plugin.ClientPlugin):
raise exception.EntityNotFound( raise exception.EntityNotFound(
entity="Container", entity="Container",
name=container_ref) name=container_ref)
raise ex raise
class SecretConstraint(constraints.BaseCustomConstraint): class SecretConstraint(constraints.BaseCustomConstraint):

View File

@ -59,7 +59,7 @@ class MistralClientPlugin(client_plugin.ClientPlugin):
raise exception.EntityNotFound( raise exception.EntityNotFound(
entity="Workflow", entity="Workflow",
name=workflow_identifier) name=workflow_identifier)
raise ex raise
class WorkflowConstraint(constraints.BaseCustomConstraint): class WorkflowConstraint(constraints.BaseCustomConstraint):

View File

@ -1734,7 +1734,7 @@ class Resource(object):
if self.client_plugin().is_not_found(ex): if self.client_plugin().is_not_found(ex):
raise exception.EntityNotFound( raise exception.EntityNotFound(
entity='Resource', name=self.name) entity='Resource', name=self.name)
raise ex raise
return resource_data return resource_data
def parse_live_resource_data(self, resource_properties, resource_data): def parse_live_resource_data(self, resource_properties, resource_data):

View File

@ -107,7 +107,7 @@ class Policy(resource.Resource):
self.client_plugin().is_not_found(ex)): self.client_plugin().is_not_found(ex)):
bd['finished'] = True bd['finished'] = True
else: else:
raise ex raise
def add_bindings(self, bindings): def add_bindings(self, bindings):
for bd in bindings: for bd in bindings:

View File

@ -500,7 +500,7 @@ class OSDBInstance(resource.Resource):
LOG.warning(_LW("Unexpected instance state change " LOG.warning(_LW("Unexpected instance state change "
"during update. Retrying.")) "during update. Retrying."))
return False return False
raise exc raise
return True return True
def _update_name(self, instance, name): def _update_name(self, instance, name):

View File

@ -762,7 +762,7 @@ class Stack(collections.Mapping):
if ignorable_errors and ex.error_code in ignorable_errors: if ignorable_errors and ex.error_code in ignorable_errors:
result = None result = None
else: else:
raise ex raise
except AssertionError: except AssertionError:
raise raise
except Exception as ex: except Exception as ex: