Source code for python_hosts.exception

# -*- coding: utf-8 -*-

"""
hosts.exceptions
-----------------------

All exceptions used in the hosts code base are defined here.
"""


[docs]class HostsException(Exception): """ Base exception class. All Hosts-specific exceptions should subclass this class. """ pass
[docs]class UnableToWriteHosts(HostsException): """ Raised when a Hosts file cannot be written. """ pass
[docs]class HostsEntryException(Exception): """ Base exception class. All HostsEntry-specific exceptions should subclass this class. """ pass
[docs]class InvalidIPv4Address(HostsEntryException): """ Raised when a HostsEntry is defined as type 'ipv4' but with an invalid address. """ pass
[docs]class InvalidIPv6Address(HostsEntryException): """ Raised when a HostsEntry is defined as type 'ipv6' but with an invalid address. """ pass
[docs]class InvalidComment(HostsEntryException): """ Raised when a HostsEntry is defined as type 'comment' but with an invalid comment """ pass