Re-raising exceptions with modified message

Christoph Zwerschke cito at online.de
Sat Jul 7 05:17:14 EDT 2007


Gerard Flanagan wrote:
> Would a decorator work here?

Depends on how you want to use that functionality. In my use case I only 
need to catch the excpetion once.

Note that in your code the exception has not the right type which is 
what I targeted in my last posting. I.e. the following will raise an 
Exception if function is decorated:

try:
     print funktion()
except ArithmeticError:
     pass

-- Chris



More information about the Python-list mailing list