for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
from exception_wrappers import DisabledError
class AccountAuthenticationError(Exception):
pass
class ConnectionError(Exception):
ConnectionError
It is generally discouraged to redefine built-ins as this makes code very hard to read.
def __init__(self, message):
__init__
Exception
It is generally advisable to initialize the super-class by calling its __init__ method:
class SomeParent: def __init__(self): self.x = 1 class SomeChild(SomeParent): def __init__(self): # Initialize the super class SomeParent.__init__(self)
self.message = message
def __str__(self):
return '%s: %s' % (
self.__class__.__name__,
self.message
)
def __repr__(self):
return '%s(%r)' % (
class PluginDisabledError(DisabledError):
def __init__(self, inner_exception=None):
super(PluginDisabledError, self).__init__(
'Plugin has been automatically disabled, check the plugin logs for more information',
inner_exception
It is generally discouraged to redefine built-ins as this makes code very hard to read.