How to except the unexpected?

Paul Rubin http
Sat Mar 4 22:35:58 CET 2006


James Stroud <jstroud at ucla.edu> writes:
> > try:
> >     process_things()
> > except Reraise:
> >     raise
> > except:
> >     log_error()
> >
> 
> Why catch an error only to re-raise it?
> 
> This falls under http://c2.com/cgi/wiki?YouReallyArentGonnaNeedThis

No, without the reraise, the bare "except:" clause would capture the
exception incorrectly and log it as an error.



More information about the Python-list mailing list