diff options
Diffstat (limited to 'pyfingerd/errors.py')
-rwxr-xr-x | pyfingerd/errors.py | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/pyfingerd/errors.py b/pyfingerd/errors.py index 6810df5..b11228d 100755 --- a/pyfingerd/errors.py +++ b/pyfingerd/errors.py @@ -3,7 +3,7 @@ # Copyright (C) 2017-2022 Thomas Touhey <thomas@touhey.fr> # This file is part of the pyfingerd project, which is MIT-licensed. # ***************************************************************************** -""" This file defines the exceptions used throughout the module. """ +"""This file defines the exceptions used throughout the module.""" __all__ = [ 'BindError', 'ConfigurationError', 'HostnameError', @@ -16,45 +16,46 @@ __all__ = [ class ConfigurationError(Exception): - """ Raised when an invalid configuration option is set. """ + """Raised when an invalid configuration option is set.""" pass class HostnameError(ConfigurationError): - """ Raised when a host name is invalid. """ + """Raised when a host name is invalid.""" def __init__(self, hostname): - super().__init__('invalid host name {}.'.format(repr(hostname))) + super().__init__(f'Invalid host name {hostname!r}.') class BindError(ConfigurationError): - """ Raised when an error has occurred with the provided binds. """ + """Raised when an error has occurred with the provided binds.""" def __init__(self, msg): super().__init__( - f'an error has occurred with the provided binds: {msg}') + f'An error has occurred with the provided binds: {msg}', + ) class NoBindsError(BindError): - """ Raised when no binds were provided. """ + """Raised when no binds were provided.""" def __init__(self): - super().__init__('no valid bind') + super().__init__('No valid bind') class InvalidBindError(BindError): - """ Raised when one of the provided binds came out erroneous. """ + """Raised when one of the provided binds came out erroneous.""" def __init__(self, bind, msg=None): super().__init__( - f'one of the provided bind ({bind!r}) ' - f'was invalid{": " + msg if msg else ""}', + f'One of the provided bind ({bind!r}) ' + + f'was invalid{": " + msg if msg else ""}', ) class MalformedQueryError(Exception): - """ Raised when a malformed query is received. """ + """Raised when a malformed query is received.""" def __init__(self, query, msg=None): self.query = query |