Modify an exception before re-raising it

Ben Finney bignose+hates-spam at benfinney.id.au
Fri Mar 6 03:58:22 EST 2009


Steven D'Aprano <steve at pearwood.info> 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
‘args’.

-- 
 \        “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