How to use “raise” keyword in Python [duplicate]
It has 2 purposes. yentup has given the first one. It’s used for raising your own errors. The second is to reraise the current exception in an exception handler, so that it can be handled further up the call stack.