>A Byte of Python

Raising Exceptions

You can raise exceptions using the raise statement - you specify the name of the error/exception and the exception object. The error or exception that you can raise should be a class which directly or indirectly is a derived class of the Error or Exception class respectively.