Coverage for tld/exceptions.py: 100%
12 statements
« prev ^ index » next coverage.py v7.2.7, created at 2024-05-26 22:29 +0000
« prev ^ index » next coverage.py v7.2.7, created at 2024-05-26 22:29 +0000
1__author__ = "Artur Barseghyan"
2__copyright__ = "2013-2023 Artur Barseghyan"
3__license__ = "MPL-1.1 OR GPL-2.0-only OR LGPL-2.1-or-later"
4__all__ = (
5 "TldBadUrl",
6 "TldDomainNotFound",
7 "TldImproperlyConfigured",
8 "TldIOError",
9)
12class TldIOError(IOError):
13 """TldIOError.
15 Supposed to be thrown when problems with reading/writing occur.
16 """
19class TldDomainNotFound(ValueError):
20 """TldDomainNotFound.
22 Supposed to be thrown when domain name is not found (didn't match) the
23 local TLD policy.
24 """
26 def __init__(self, domain_name):
27 super(TldDomainNotFound, self).__init__(
28 "Domain %s didn't match any existing TLD name!" % domain_name
29 )
32class TldBadUrl(ValueError):
33 """TldBadUrl.
35 Supposed to be thrown when bad URL is given.
36 """
38 def __init__(self, url):
39 super(TldBadUrl, self).__init__("Is not a valid URL %s!" % url)
42class TldImproperlyConfigured(Exception):
43 """TldImproperlyConfigured.
45 Supposed to be thrown when code is improperly configured. Typical use-case
46 is when user tries to use `get_tld` function with both `search_public` and
47 `search_private` set to False.
48 """