Andrew Berg wrote:
On 2011.05.12 02:25 PM, MRAB wrote:
You can raise an exception wherever you like! :-)
If I raise an exception that isn't a built-in exception, I get something
like "NameError: name 'HelloError' is not defined". I don't know how to
define the exception.

class HelloError(Exception):
    "custom exception"

and that's all you need. You can override __init__ to add your own attributes, etc, if you need to.

~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to