This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author abathur
Recipients abathur
Date 2015-04-09.20:18:27
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1428610708.13.0.662863454956.issue23902@psf.upfronthosting.co.za>
In-reply-to
Content
I've been working on a testing tool which raises its own exceptions from those thrown by code under test. The tool's exceptions do some analysis to categorize and add additional information to the underlying exceptions, and they need access to the __cause__ property in order to build this information.

Unfortunately, because the __cause__ property isn't available on the exception objects at init time, some number of workarounds must be employed which make the exception harder to use properly and code handling it less intuitive. While the workarounds are fine at the moment, it would be ideal if the exceptions could be notified instead of burdening the site of each use with workarounds.

It seems sufficient to call a magic method on the exception immediately after these the traceback/cause/context parameters have been set while it is being raised, allowing the exception to perform any essential work. A bells-and-whistles implementation might be a magic method called at raise time with all of these properties as arguments (and the responsibility to deal with them)--but I assume there are reasons exception objects don't already have this level of control.
History
Date User Action Args
2015-04-09 20:18:28abathursetrecipients: + abathur
2015-04-09 20:18:28abathursetmessageid: <1428610708.13.0.662863454956.issue23902@psf.upfronthosting.co.za>
2015-04-09 20:18:28abathurlinkissue23902 messages
2015-04-09 20:18:27abathurcreate