On Thu, Apr 9, 2020 at 5:31 PM Soni L. <fakedme+py@gmail.com> wrote:
Sometimes, you have an API:

             PropertyError: If the property is not supported by this config
             LookupError: If the property is supported, but isn't available.
             ValueError: If the property doesn't have exactly one value.
         raise PropertyError

and you don't want your API to mask bugs. How would it mask bugs? For
example, if API consumers do an:

         x = foo.get_property_value(prop)
     except ValueError:
         # handle it


If you don't want standard Python exceptions, such as ValueError to be confused with exceptions from your own app, just create your own custom exceptions such as

class MyAppValueError(Exception):

and raise these custom exceptions when necessary.
No need to change Python or use convoluted logic.

André Roberge 
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-leave@python.org
Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/J76S2NBEVKX2MHZULELM22IHT5H7KLP3/
Code of Conduct: http://python.org/psf/codeofconduct/