Re-raising exceptions with modified message

fumanchu fumanchu at amor.org
Mon Jul 16 12:50:50 EDT 2007


On Jul 15, 2:55 am, Christoph Zwerschke <c... at online.de> wrote:
> Here is a simple solution, but it depends
> on the existence of the args attribute that
> "will eventually be deprecated" according
> to the docs

If you don't mind using .args, then the solution is usually as simple
as:


try:
    Thing.do(arg1, arg2)
except Exception, e:
    e.args += (Thing.state, arg1, arg2)
    raise


No over-engineering needed. ;)


Robert Brewer
System Architect
Amor Ministries
fumanchu at amor.org




More information about the Python-list mailing list