Often I will write a generic exception such as the following:
class MyException(Exception):
"My custom exception."
pass
This way I can check if that exception is the one I want in something like a try/except
block. Yet pylint
complains about this as follows:
unnecessary-pass: Unnecessary pass statement
What's the rationale behind this complaint? And is there a more preferred way to do the above? Even the python docs suggest using something like that for a user-defined exception:
class Error(Exception):
"""Base class for exceptions in this module."""
pass