Feb-09-2021, 07:11 AM
(This post was last modified: Feb-09-2021, 07:11 AM by Gribouillis.)
Nothing is simpler than writing your own exception
class MyException(RuntimeError): pass class MySubException(MyException): pass raise MySubException('That file is too large!')The drawback of returning an error code is that it forces the caller to check the error code. On the other hand, if a function raises exceptions, you can just call the function and let the exceptions propagate.