[docs] [issue34538] Remove encouragement to author a base class for all Exception subclasses in a module

Marc-Andre Lemburg report at bugs.python.org
Mon Oct 1 11:22:07 EDT 2018


Marc-Andre Lemburg <mal at egenix.com> added the comment:

Just as extra data point:

It is fairly common to have a common exception class which is then used a mixin class together with the standard exception classes, so that you can indeed identify the source of an exception and catch errors based on the source (e.g. say you want to catch database errors coming from MySQL specifically).

The Python DB-API also requires to create a separate hierarchy for this purpose.

Overall, I wouldn't call this a non-best practice. It depends on the use case, whether it's useful or not.

----------
nosy: +lemburg

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34538>
_______________________________________


More information about the docs mailing list