Advertisement



< Prev
Next >



Python - User Defined Exceptions





Apart from using the built-in exception classes, we could even create our own exception classes and once we have created our own exception class, we will be able to raise and catch our own exception just as we raise and catch the built-in exceptions. Let's see how to get it done.




How to create our own exception class


In order to create our own exception classes, we simply just have to create a class which inherits any inbuilt exception class. For example -





Please Subscribe

Please subscribe to our social media channels for daily updates.


Decodejava Facebook Page  DecodeJava Twitter Page Decodejava Google+ Page




Advertisement



Notifications



Please check our latest addition

C#, PYTHON and DJANGO


Advertisement