Introduction
The PEP8 naming convention suggests that exceptions should have the suffix "Error" on exception names (if the exception actually is an error) but a lot of exceptions does not follow them.
Proposal
- rename exceptions to follow the naming convention
- Concider whether there are Pywikibot Errors which should not follow this rule
- Find a way to deprecate the renamed exception
Hints
Here is a code snipped how to proceed and implement a deprecation warning:
class NoPageError(PageRelatedError): """Page does not exist.""" message = "Page %s doesn't exist." class DeprecatedException: def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) print('Exception "{}" is deprecated'.format(self.__class__.__name__)) def __str__(self): print('Exception "{}" is deprecated'.format(self.__class__.__name__)) super().__getattr__(attr) class NoPage(DeprecatedExcption, NoPageError): pass
DeprecatedException class should use pywikibot.tools.issue_deprecation_warning to print the warning. Use a separate method to do it. The parameters like instead or since should be passed as keyword parameters to DeprecatedException.__init__. We always can use a FutureWarning as warning_class.
Please always split your commits into parts and do not patch more than 10 files at once for better reviewing.