From c76ee2557dd6968f6e1ea0fc6de2dae05c1889a3 Mon Sep 17 00:00:00 2001 From: Joshua Harlow Date: Fri, 17 Apr 2015 17:55:31 -0700 Subject: [PATCH] Validate correct exception subclass in 'raise_with_cause' Change-Id: Ia1a8b692eda2f3856bb4e23a9baa34ac06096d3a --- taskflow/exceptions.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/taskflow/exceptions.py b/taskflow/exceptions.py index 15a73b3b..3d153ffc 100644 --- a/taskflow/exceptions.py +++ b/taskflow/exceptions.py @@ -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: