While we can use the Exception class to create and raise new errors, it is not the recommended method. The Exception class does not distinguish between different types of errors. It is a broad and generic class that classifies all exceptions the same way.
To help exception handlers (try-except block) distinguish between errors, we create a child exception class.
We can use the InvalidAgeException
in a try-except block to handle age-related errors separately.