What else is going on in your code?
MyCustomException must be checked and handled before the thread ever gets into the second except clause
In [1]: def test(): ...: try: ...: raise ValueError() ...: except ValueError: ...: print('valueerror') ...: except Exception: ...: print('exception') ...: In [2]: test() valueerror In [3]: issubclass(ValueError,Exception) Out[3]: True
dm03514
source share