[Tutor] Error Raising (Joseph Q.)

Kent Johnson kent37 at tds.net
Thu Apr 21 14:43:12 CEST 2005


Joseph Quigley wrote:
> (here I go again?)
> Where could I find a nice long list of the errors I can raise? (I mean 
> like EOF errors when some one doesn't fill in their name when they're 
> supposed to).

The standard (built-in) exceptions are documented here:
http://docs.python.org/lib/module-exceptions.html

If you don't find any that suit you, defining your own is as easy as

class MyException(Exception):
   pass

....
try:
   raise MyException
except MyException:
   ...

Kent



More information about the Tutor mailing list