Probably the more correct way to specify filtering exceptions that are defined in the package is not to work with names as with strings, but to ensure the correct inheritance hierarchy. You can declare a general exception like PonyException and inherit all other exceptions from it. And in this fragment, replace the work with strings with a simple check via isinstance.
Hello!
I was looking at the pony source code and I was confused by the following fragment:
https://github.com/ponyorm/pony/blob/6f7620c9e66a4b8d4f7f7ba4a456b733aab9f374/pony/utils/utils.py#L68C22-L68C22
Probably the more correct way to specify filtering exceptions that are defined in the package is not to work with names as with strings, but to ensure the correct inheritance hierarchy. You can declare a general exception like
PonyException
and inherit all other exceptions from it. And in this fragment, replace the work with strings with a simple check viaisinstance
.