When an exception occurs, it starts at the innermost level possible (a child) and travels upward (through the parents), waiting to be caught. This means a couple of things to a programmer:
- If you don't know what exception may occur, you can always just catch a higher-level exception. For example, if you didn't know that ZeroDivisionError from the preceding exception example was its own exception, you could have used the ArithmeticError for the exception and caught that. The following exceptions list shows that ZeroDivisionError is a child of ArithmeticError, which in turn is a child of Exception, which in turn is a child of BaseException, which is the default class that all other exceptions derive from.
- Multiple ...