Merge "Validate correct exception subclass in 'raise_with_cause'"

This commit is contained in:
Jenkins
2015-04-18 18:58:18 +00:00
committed by Gerrit Code Review

View File

@@ -46,6 +46,8 @@ def raise_with_cause(exc_cls, message, *args, **kwargs):
:param kwargs: any additional keyword arguments to pass to the
exceptions constructor.
"""
if not issubclass(exc_cls, TaskFlowException):
raise ValueError("Subclass of taskflow exception is required")
if 'cause' not in kwargs:
exc_type, exc, exc_tb = sys.exc_info()
if exc is not None: