Python3 IOError Exception hierarchy
by shogun1234 from LinuxQuestions.org on (#50K7W)
Not very familiar with Python3. Recently I am refactoring some code, finding following class relationship where UserApiError actually inherit from IOError. However in some other python files (.py) it would raise UserApiError(HttpError("remote http service goes wrong!")). I am confused because checking some online docs ( e.g. https://www.tutorialspoint.com/objec..._classes.htm); though Exception are the parent of IOError, HttpError should have no direct relation with IOError. Why it's valid to pass in HttpError to UserApiError class?
Code:class Error(Exception):
pass
class HttpError(Error):
pass
class UserApiError(IOError):
"""Wrapper that wraps actual error, exception and throws back to caller"""
pass


Code:class Error(Exception):
pass
class HttpError(Error):
pass
class UserApiError(IOError):
"""Wrapper that wraps actual error, exception and throws back to caller"""
pass