Modify an exception before re-raising it

Ben Finney bignose+hates-spam at
Fri Mar 6 09:58:22 CET 2009

Steven D'Aprano <steve at> writes:

> Okay, if other people are doing it, I'm happy to rely on it as
> something which shouldn't just go away without warning. Thanks to
> everyone who replied.

If you only want to modify the exception's message string, the
‘message’ attribute is standard IIRC. No need to re-write the entire

 \        “Humanity has advanced, when it has advanced, not because it |
  `\     has been sober, responsible, and cautious, but because it has |
_o__)            been playful, rebellious, and immature.” —Tom Robbins |
Ben Finney

More information about the Python-list mailing list