Exception handling
Catch all exceptions
Catch a specific exception
Throw an exception
Re-throw exceptions
Define an exception type
Guaranteed code execution
If no exception occurred
Method throwing an exception
class
SimpleException
(Exception):
pass
raise
SimpleException
(
"Oops!"
)
# <-Error