+ 5
you create custom exception by creating a class that inherits from the Exception class, it can be done with one line:
class CustomException(Exception): pass
you can now raise it whenever needed:
raise CustomException('message')
I hope this helps :)