Which exception has been used? (was: Which exception to use?)

Laura Creighton lac at strakt.com
Fri Jan 31 00:22:27 CET 2003


<snip>

> Suppose, as is always true, though, that I'm dealing
> with modules not under my control.  How do I catch
> "other"?  There must be something I'm missing about
> the new type and exception systems, 'cause I don't 
> see a Pythonic way to write
>   ....
>   except OTHER, e:
>       # The foreign code threw an exception of
>       #    a type I don't recognize, but I need
>       #    to process/log/... 'e'.
>       cope(e)
> Yes, I can write
>   ....
>   except:
>       cope()
> but then I've lost the information I want in 'e'.

 It is sitting around in  sys.exc_info(). Grab it before another exception
 happens. 

> 
> Cameron Laird <Cameron at Lairds.com>
> Business:  http://www.Phaseit.net
> Personal:  http://phaseit.net/claird/home.html
> -- 
> http://mail.python.org/mailman/listinfo/python-list

Laura







More information about the Python-list mailing list