You can raise exceptions.
To trigger an exception manually, run a raise statement.
User-triggered exceptions are caught the same way as those Python raises.
try: raise IndexError # Trigger exception manually except IndexError: print('got exception')
If the exception is not caught, user-triggered exceptions are propagated up to the top-level default exception handler.
It will terminate the program with a standard error message: