A custom exception is a class that inherits from Exception (or a subclass) to precisely name an error specific to the application. You raise it with raise and catch it with except. A hierarchy of exceptions makes error handling clearer than generic messages.
Example
class StockInsuffisant(Exception):
pass
raise StockInsuffisant('out of stock')