Python by Swaroop C H - HTML preview

PLEASE NOTE: This is an HTML preview only and some elements such as links or page numbers may be incorrect.
Download the book in PDF, ePub, Kindle for a complete version.

Raising Exceptions

You can raise exceptions using theraise statement. You also have to specify the name of the error/ exception and the exception object that is to be thrown along with the exception. The error or exception that you can arise should be class which directly or indirectly is a derived class of theError orException class respectively.