1class MyException(Exception):
2 """You can put code here"""
3 pass
4
5class MyOtherException(MyException):
6 """You can also put code here"""
7 pass
1>>> class CustomError(Exception):
2... pass
3...
4
5>>> raise CustomError
6Traceback (most recent call last):
7...
8__main__.CustomError
9
10>>> raise CustomError("An error occurred")
11Traceback (most recent call last):
12...
13__main__.CustomError: An error occurred