Should all custom exception classes inherit from Exception?


#1

Question

When defining custom exception classes, should they all inherit from the Exception class?

Answer

Yes, all custom exception classes should either directly inherit from the Python Exception class or should inherit from another class (or chain of classes) which can trace back to Exception.