Re-raising exceptions with modified message

Christoph Zwerschke cito at
Sat Jul 7 11:17:14 CEST 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:

     print funktion()
except ArithmeticError:

-- Chris

More information about the Python-list mailing list