Message 278350 - Python tracker (original) (raw)

Alternative patch chain original exception as cause instead of context. What is better?

class FaultyImplementation: ... def set_name(self, *args): ... 1/0 ... class TheoreticallyCouldWork: ... attr = FaultyImplementation() ... ZeroDivisionError: division by zero

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "", line 1, in RuntimeError: Error calling set_name on 'FaultyImplementation' instance 'attr' in 'TheoreticallyCouldWork'