]> git.mxchange.org Git - fba.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Mon, 27 Jan 2025 01:27:34 +0000 (02:27 +0100)
committerRoland Häder <roland@mxchange.org>
Mon, 27 Jan 2025 01:27:34 +0000 (02:27 +0100)
- proper exception, not ValueException when it is a runtime exception

19 files changed:
fba/helpers/blocklists.py
fba/helpers/blocks.py
fba/helpers/cookies.py
fba/helpers/domain.py
fba/helpers/json.py
fba/helpers/processing.py
fba/http/csrf.py
fba/http/federation.py
fba/http/network.py
fba/models/blocks.py
fba/models/error_log.py
fba/models/instances.py
fba/networks/friendica.py
fba/networks/lemmy.py
fba/networks/mastodon.py
fba/networks/misskey.py
fba/networks/peertube.py
fba/networks/pleroma.py
fba/utils.py

index c208049c08c5e5682632753d91807509d1dcf16d..61467d065a9063a698717ec432a8b03279e68c36 100644 (file)
@@ -79,7 +79,7 @@ def has(domain: str) -> bool:
     domain_helper.raise_on(domain)
 
     if blacklist.is_blacklisted(domain):
-        raise ValueError(f"domain='{domain}' is blacklisted but function was invoked")
+        raise RuntimeError(f"domain='{domain}' is blacklisted but function was invoked")
 
     # Default is not found
     found = False
index f522d57a03ca8885edb229c8ce4912312ccdfa7d..58836f110ecb70b375cd6a7b76afa32940736978 100644 (file)
@@ -29,7 +29,7 @@ def alias_block_level(block_level: str) -> str:
     if not isinstance(block_level, str):
         raise TypeError(f"Parameter block_level[]='{type(block_level)}' is not of type 'str'")
     elif block_level in ["accept", "accepted"]:
-        raise ValueError(f"Parameter block_level='{block_level}' is 'accept(ed)' but function was invoked")
+        raise RuntimeError(f"Parameter block_level='{block_level}' is 'accept(ed)' but function was invoked")
     elif block_level == "silence":
         logger.debug("Block level 'silence' has been changed to 'silenced'")
         block_level = "silenced"
index 6b2cbff1cac68eabf95b4a6866dbe5d3e1df1f29..16c87115b127d45dd90be32af312133745d9aa6f 100644 (file)
@@ -31,7 +31,7 @@ def store(domain: str, cookies: dict):
     domain_helper.raise_on(domain)
 
     if blacklist.is_blacklisted(domain):
-        raise ValueError(f"domain='{domain}' is blacklisted but function was invoked")
+        raise RuntimeError(f"domain='{domain}' is blacklisted but function was invoked")
     elif not isinstance(cookies, dict):
         raise TypeError(f"Parameter cookies[]='{type(cookies)}' is not of type 'dict'")
 
@@ -44,7 +44,7 @@ def get_all(domain: str) -> dict:
     domain_helper.raise_on(domain)
 
     if blacklist.is_blacklisted(domain):
-        raise ValueError(f"domain='{domain}' is blacklisted but function was invoked")
+        raise RuntimeError(f"domain='{domain}' is blacklisted but function was invoked")
     elif domain not in _cookies:
         return []
 
@@ -56,7 +56,7 @@ def has(domain: str) -> bool:
     domain_helper.raise_on(domain)
 
     if blacklist.is_blacklisted(domain):
-        raise ValueError(f"domain='{domain}' is blacklisted but function was invoked")
+        raise RuntimeError(f"domain='{domain}' is blacklisted but function was invoked")
 
     has_cookies = domain in _cookies
 
@@ -68,7 +68,7 @@ def clear(domain: str):
     domain_helper.raise_on(domain)
 
     if blacklist.is_blacklisted(domain):
-        raise ValueError(f"domain='{domain}' is blacklisted but function was invoked")
+        raise RuntimeError(f"domain='{domain}' is blacklisted but function was invoked")
 
     if has(domain):
         logger.debug("Removing cookies for domain='%s' ...", domain)
index 9094663100d9cc266324d844e5f6b15b169af763..d3e63ef2b84a23796d94868686aacf220c9b94bf 100644 (file)
@@ -60,13 +60,13 @@ def is_in_url(domain: str, url: str) -> bool:
     raise_on(domain)
 
     if blacklist.is_blacklisted(domain):
-        raise ValueError(f"domain='{domain}' is blacklisted but function was invoked")
+        raise RuntimeError(f"domain='{domain}' is blacklisted but function was invoked")
     elif not isinstance(url, str):
         raise TypeError(f"Parameter url[]='{type(url)}' is not of type 'str'")
     elif url == "":
         raise ValueError("Parameter 'url' is empty")
     elif not validators.url(url):
-        raise ValueError(f"Parameter url='{url}' is not a valid URL")
+        raise RuntimeError(f"Parameter url='{url}' is not a valid URL but function was invoked")
 
     punycode = encode_idna(domain)
     logger.debug("punycode='%s'", punycode)
index 4323b27cea7b601712555a9668c45e78cad2a2f0..585131972229de683a3b84c01474f2ce049abe5f 100644 (file)
@@ -29,7 +29,7 @@ def is_json_response(response: requests.models.Response) -> bool:
     if not isinstance(response, requests.models.Response):
         raise TypeError(f"Parameter response[]='{type(response)}' is not type of 'Response'")
     elif not response.ok or response.status_code > 200:
-        raise ValueError(f"response.ok='{response.ok}',response.status_code={response.status_code},response.reason='{response.reason}' but function was invoked")
+        raise RuntimeError(f"response.ok='{response.ok}',response.status_code={response.status_code},response.reason='{response.reason}' but function was invoked")
 
     is_json = response.headers.get("content-type") is None or response.headers.get("content-type").split(";")[0] in ["*/*", "application/json", "application/jrd+json", "application/activity+json"]
 
@@ -42,7 +42,7 @@ def from_response(response: requests.models.Response) -> any:
     if not isinstance(response, requests.models.Response):
         raise TypeError(f"Parameter response[]='{type(response)}' is not type of 'Response'")
     elif not response.ok or response.status_code > 200:
-        raise ValueError(f"response.ok='{response.ok}',response.status_code={response.status_code},response.reason='{response.reason}' but function was invoked")
+        raise RuntimeError(f"response.ok='{response.ok}',response.status_code={response.status_code},response.reason='{response.reason}' but function was invoked")
     elif response.text.strip() != "" and not is_json_response(response):
         logger.warning("response.headers[content-type]='%s' is not a JSON type, below json() invocation may raise an exception", response.headers.get("content-type"))
 
index 0acec17bcc8e5fe4af7d82526f3015cd526a2250..934969401c02bee3ea7e8f9cb3d167c29ea7031a 100644 (file)
@@ -48,9 +48,9 @@ def instance(blocked: str, blocker: str, command: str, force: bool = False) -> b
     elif command == "":
         raise ValueError("Parameter 'command' is empty")
     elif blacklist.is_blacklisted(blocked):
-        raise ValueError(f"blocked='{blocked}' is blacklisted but function was invoked")
+        raise RuntimeError(f"blocked='{blocked}' is blacklisted but function was invoked")
     elif blacklist.is_blacklisted(blocker):
-        raise ValueError(f"blocker='{blocker}' is blacklisted but function was invoked")
+        raise RuntimeError(f"blocker='{blocker}' is blacklisted but function was invoked")
 
     logger.debug("blocked='%s' - BEFORE!", blocked)
     blocked = utils.deobfuscate(blocked, blocker)
@@ -102,9 +102,9 @@ def block(blocker: str, blocked: str, reason: str, block_level: str) -> bool:
     elif block_level in ["reject", "suspend", "accept", "silence", "nsfw", "quarantined_instances"]:
         raise ValueError(f"Parameter block_level='{block_level}' is not supported")
     elif blacklist.is_blacklisted(blocker):
-        raise ValueError(f"blocker='{blocker}' is blacklisted but function was invoked")
+        raise RuntimeError(f"blocker='{blocker}' is blacklisted but function was invoked")
     elif blacklist.is_blacklisted(blocked):
-        raise ValueError(f"blocked='{blocked}' is blacklisted but function was invoked")
+        raise RuntimeError(f"blocked='{blocked}' is blacklisted but function was invoked")
 
     added = False
     if not blocks.is_instance_blocked(blocker, blocked, block_level):
@@ -137,7 +137,7 @@ def csv_block(blocker: str, url: str, command: str) -> None:
     elif command == "":
         raise ValueError("Parameter 'command' is empty")
     elif blacklist.is_blacklisted(blocker):
-        raise ValueError(f"blocker='{blocker}' is blacklisted but function was invoked")
+        raise RuntimeError(f"blocker='{blocker}' is blacklisted but function was invoked")
 
     logger.debug("Setting last_blocked for blocker='%s' ...", blocker)
     instances.set_last_blocked(blocker)
index a9102f19d9bcf82c1bf754f5b26e2a436eda2691..3ddfe403798faf5e47fcadbb325f00b1f62676ae 100644 (file)
@@ -37,7 +37,7 @@ def determine(domain: str, headers: dict) -> dict:
     domain_helper.raise_on(domain)
 
     if blacklist.is_blacklisted(domain):
-        raise RuntimeError(f"domain='{domain}' is blacklisted but function is invoked")
+        raise RuntimeError(f"domain='{domain}' is blacklisted but function was invoked")
     elif not isinstance(headers, dict):
         raise TypeError(f"Parameter headers[]='{type(headers)}' is not of type 'dict'")
 
index 6349b7f64dc113a5d69850d4ee4bb6cdf9b13060..5fac5588fd34d2381425a8497189265e60b4eb46 100644 (file)
@@ -77,7 +77,7 @@ def fetch_instances(domain: str, origin: str, software: str, command: str, path:
     elif path is not None and not path.startswith("/"):
         raise ValueError(f"path='{path}' does not start with a slash")
     elif _DEPTH > 0 and instances.is_recent(domain, "last_instance_fetch"):
-        raise ValueError(f"domain='{domain}' has recently been fetched but function was invoked")
+        raise RuntimeError(f"domain='{domain}' has recently been fetched but function was invoked")
     elif software is None and not instances.is_recent(domain, "last_instance_fetch"):
         try:
             logger.debug("Software for domain='%s',path='%s' is not set, determining ...", domain, path)
@@ -231,7 +231,7 @@ def fetch_peers(domain: str, software: str, origin: str) -> list:
     elif isinstance(software, str) and software == "":
         raise ValueError("Parameter 'software' is empty")
     elif software is not None and software_helper.is_relay(software):
-        raise ValueError(f"domain='{domain}' is of software='{software}' and isn't supported here.")
+        raise RuntimeError(f"domain='{domain}' is of software='{software}' and isn't supported here.")
     elif not isinstance(origin, str) and origin is not None:
         raise TypeError(f"Parameter origin[]='{type(origin)}' is not of type 'str'")
     elif isinstance(origin, str) and origin == "":
@@ -605,7 +605,7 @@ def fetch_blocks(domain: str) -> list:
     if blacklist.is_blacklisted(domain):
         raise RuntimeError(f"domain='{domain}' is blacklisted but function was invoked")
     elif not instances.is_registered(domain):
-        raise RuntimeError(f"domain='{domain}' is not registered but function is invoked")
+        raise RuntimeError(f"domain='{domain}' is not registered but function was invoked")
 
     # Init block list
     blocklist = []
index 8a3bd67b5eab4914c8f6d72be58f95facfd00ff8..fe2cacd88bdb09b62e0e206985405d83cd6dd797 100644 (file)
@@ -70,7 +70,7 @@ def post_json_api(domain: str, path: str, data: str = "", headers: dict = {}) ->
     domain_helper.raise_on(domain)
 
     if blacklist.is_blacklisted(domain):
-        raise ValueError(f"domain='{domain}' is blacklisted but function was invoked")
+        raise RuntimeError(f"domain='{domain}' is blacklisted but function was invoked")
     elif not isinstance(path, str):
         raise TypeError(f"path[]='{type(path)}' is not of type 'str'")
     elif path == "":
@@ -174,7 +174,7 @@ def get_json_api(domain: str, path: str, headers: dict, timeout: tuple) -> dict:
     domain_helper.raise_on(domain)
 
     if blacklist.is_blacklisted(domain):
-        raise ValueError(f"domain='{domain}' is blacklisted but function was invoked")
+        raise RuntimeError(f"domain='{domain}' is blacklisted but function was invoked")
     elif not isinstance(path, str):
         raise TypeError(f"path[]='{type(path)}' is not of type 'str'")
     elif path == "":
@@ -233,7 +233,7 @@ def send_bot_post(domain: str, blocklist: list) -> None:
     domain_helper.raise_on(domain)
 
     if blacklist.is_blacklisted(domain):
-        raise ValueError(f"domain='{domain}' is blacklisted but function was invoked")
+        raise RuntimeError(f"domain='{domain}' is blacklisted but function was invoked")
     elif not isinstance(blocklist, list):
         raise TypeError(f"Parameter blocklist[]='{type(blocklist)}' is not of type 'list'")
     elif len(blocklist) == 0:
@@ -285,7 +285,7 @@ def _fetch_response(domain: str, path: str, headers: dict, timeout: tuple, allow
     domain_helper.raise_on(domain)
 
     if blacklist.is_blacklisted(domain):
-        raise ValueError(f"domain='{domain}' is blacklisted but function was invoked")
+        raise RuntimeError(f"domain='{domain}' is blacklisted but function was invoked")
     elif not isinstance(path, str):
         raise TypeError(f"Parameter path[]='{type(path)}' is not of type 'str'")
     elif path == "":
@@ -429,7 +429,7 @@ def get_generic(domain: str, path: str, allow_redirects: bool = False) -> reques
     domain_helper.raise_on(domain)
 
     if blacklist.is_blacklisted(domain):
-        raise ValueError(f"domain='{domain}' is blacklisted but function was invoked")
+        raise RuntimeError(f"domain='{domain}' is blacklisted but function was invoked")
     elif not isinstance(path, str):
         raise TypeError(f"Parameter path[]='{type(path)}' is not of type 'str'")
     elif path == "":
index ee71d4c815923cd982140776e9155ab55818436e..dd4979aaad022ae808d881c78f1ed279147e4e01 100644 (file)
@@ -44,7 +44,7 @@ def get_reason(blocker: str, blocked: str, block_level: str) -> str:
     elif blacklist.is_blacklisted(blocked):
         raise RuntimeError(f"blocked='{blocked}' is blacklisted but function invoked")
     elif not is_instance_blocked(blocker, blocked, block_level):
-        raise RuntimeError(f"blocker='{blocker}',blocked='{blocked}',block_level='{block_level}' is not registered but function is invoked")
+        raise RuntimeError(f"blocker='{blocker}',blocked='{blocked}',block_level='{block_level}' is not registered but function was invoked")
 
     database.cursor.execute(
         "SELECT reason FROM blocks WHERE blocker = ? AND blocked = ? AND block_level = ? LIMIT 1",
@@ -79,7 +79,7 @@ def update_reason(reason: str, blocker: str, blocked: str, block_level: str) ->
     elif blacklist.is_blacklisted(blocked):
         raise RuntimeError(f"blocked='{blocked}' is blacklisted but function invoked")
     elif not is_instance_blocked(blocker, blocked, block_level):
-        raise RuntimeError(f"blocker='{blocker}',blocked='{blocked}',block_level='{block_level}' is not registered but function is invoked")
+        raise RuntimeError(f"blocker='{blocker}',blocked='{blocked}',block_level='{block_level}' is not registered but function was invoked")
 
     logger.debug("Updating block reason='%s',blocker='%s',blocked='%s',block_level='%s'", reason, blocker, blocked, block_level)
     database.cursor.execute(
@@ -110,7 +110,7 @@ def update_last_seen(blocker: str, blocked: str, block_level: str) -> None:
     elif blacklist.is_blacklisted(blocked):
         raise RuntimeError(f"blocked='{blocked}' is blacklisted but function invoked")
     elif not is_instance_blocked(blocker, blocked, block_level):
-        raise RuntimeError(f"blocker='{blocker}',blocked='{blocked}',block_level='{block_level}' is not registered but function is invoked")
+        raise RuntimeError(f"blocker='{blocker}',blocked='{blocked}',block_level='{block_level}' is not registered but function was invoked")
 
     database.cursor.execute(
         "UPDATE blocks SET last_seen = ? WHERE blocker = ? AND blocked = ? AND block_level = ? LIMIT 1",
index bbdd94c460ee63f342a890e019339f92f361c34a..718540d30e17b941d7a639e1e02a18bddbd9e819 100644 (file)
@@ -35,7 +35,7 @@ def add(domain: str, error: dict) -> None:
     domain_helper.raise_on(domain)
 
     if blacklist.is_blacklisted(domain):
-        raise ValueError(f"domain='{domain}' is blacklisted but function was invoked")
+        raise RuntimeError(f"domain='{domain}' is blacklisted but function was invoked")
     elif not _write_error_log:
         raise RuntimeError("Logging of errors is disabled but function was invoked")
 
index 61b8e287973ab857ea13325ff354225d9772a05d..f9e23ebd1078aa345aa7228647cede4d75eb026b 100644 (file)
@@ -109,7 +109,7 @@ def has_pending(domain: str) -> bool:
     domain_helper.raise_on(domain)
 
     if not is_registered(domain):
-        raise ValueError(f"domain='{domain}' is not registered but function was invoked")
+        raise RuntimeError(f"domain='{domain}' is not registered but function was invoked")
     elif blacklist.is_blacklisted(domain):
         raise RuntimeError(f"domain='{domain}' is blacklisted but function has been invoked")
 
index 95356d5c334dd75be070e0bb04dadf70a86b1714..e5c94cc3e8038653cdea02d1a74bba662b42c74f 100644 (file)
@@ -35,9 +35,9 @@ def fetch_blocks(domain: str) -> list:
     domain_helper.raise_on(domain)
 
     if blacklist.is_blacklisted(domain):
-        raise RuntimeError(f"domain='{domain}' is blacklisted but function is invoked")
+        raise RuntimeError(f"domain='{domain}' is blacklisted but function was invoked")
     elif not instances.is_registered(domain):
-        raise RuntimeError(f"domain='{domain}' is not registered but function is invoked")
+        raise RuntimeError(f"domain='{domain}' is not registered but function was invoked")
 
     blocklist = []
     block_tag = None
index 7ecd7d068f36acb62c1231d053be4db7a59e7ec0..6b5d739f0ce4c8ea00aac63801bea3f0552d1267 100644 (file)
@@ -73,9 +73,9 @@ def fetch_peers(domain: str, origin: str) -> list:
     domain_helper.raise_on(domain)
 
     if blacklist.is_blacklisted(domain):
-        raise RuntimeError(f"domain='{domain}' is blacklisted but function is invoked")
+        raise RuntimeError(f"domain='{domain}' is blacklisted but function was invoked")
     elif not instances.is_registered(domain):
-        raise RuntimeError(f"domain='{domain}' is not registered but function is invoked")
+        raise RuntimeError(f"domain='{domain}' is not registered but function was invoked")
 
 
     # No CSRF by default, you don't have to add network.api_headers by yourself here
@@ -133,9 +133,9 @@ def fetch_blocks(domain: str) -> list:
     domain_helper.raise_on(domain)
 
     if blacklist.is_blacklisted(domain):
-        raise RuntimeError(f"domain='{domain}' is blacklisted but function is invoked")
+        raise RuntimeError(f"domain='{domain}' is blacklisted but function was invoked")
     elif not instances.is_registered(domain):
-        raise RuntimeError(f"domain='{domain}' is not registered but function is invoked")
+        raise RuntimeError(f"domain='{domain}' is not registered but function was invoked")
 
     blocklist = []
 
@@ -243,7 +243,7 @@ def fetch_instances(domain: str, origin: str) -> list:
     domain_helper.raise_on(domain)
 
     if blacklist.is_blacklisted(domain):
-        raise RuntimeError(f"domain='{domain}' is blacklisted but function is invoked")
+        raise RuntimeError(f"domain='{domain}' is blacklisted but function was invoked")
 
     peers = []
 
index e4e62366577ef5fb8ef97872389a703730b3420c..c74c289afabe6fdd0d8a38e6f8c7f31168b317d4 100644 (file)
@@ -71,9 +71,9 @@ def fetch_blocks_from_about(domain: str) -> dict:
     domain_helper.raise_on(domain)
 
     if blacklist.is_blacklisted(domain):
-        raise RuntimeError(f"domain='{domain}' is blacklisted but function is invoked")
+        raise RuntimeError(f"domain='{domain}' is blacklisted but function was invoked")
     elif not instances.is_registered(domain):
-        raise RuntimeError(f"domain='{domain}' is not registered but function is invoked")
+        raise RuntimeError(f"domain='{domain}' is not registered but function was invoked")
 
     # Init variables
     doc = None
@@ -167,9 +167,9 @@ def fetch_blocks(domain: str) -> list:
     domain_helper.raise_on(domain)
 
     if blacklist.is_blacklisted(domain):
-        raise RuntimeError(f"domain='{domain}' is blacklisted but function is invoked")
+        raise RuntimeError(f"domain='{domain}' is blacklisted but function was invoked")
     elif not instances.is_registered(domain):
-        raise RuntimeError(f"domain='{domain}' is not registered but function is invoked")
+        raise RuntimeError(f"domain='{domain}' is not registered but function was invoked")
 
     # Init variables
     blocklist = []
index 1f5498564fa7d5e3ebcd6b030e4d1dd1fdd64042..d958e833de0929824105cd4b93bd38ef29f48a16 100644 (file)
@@ -37,9 +37,9 @@ def fetch_peers(domain: str) -> list:
     domain_helper.raise_on(domain)
 
     if blacklist.is_blacklisted(domain):
-        raise RuntimeError(f"domain='{domain}' is blacklisted but function is invoked")
+        raise RuntimeError(f"domain='{domain}' is blacklisted but function was invoked")
     elif not instances.is_registered(domain):
-        raise RuntimeError(f"domain='{domain}' is not registered but function is invoked")
+        raise RuntimeError(f"domain='{domain}' is not registered but function was invoked")
 
     logger.debug("domain='%s' is misskey, sending API POST request ...", domain)
     peers  = []
@@ -136,9 +136,9 @@ def fetch_blocks(domain: str) -> list:
     domain_helper.raise_on(domain)
 
     if blacklist.is_blacklisted(domain):
-        raise RuntimeError(f"domain='{domain}' is blacklisted but function is invoked")
+        raise RuntimeError(f"domain='{domain}' is blacklisted but function was invoked")
     elif not instances.is_registered(domain):
-        raise RuntimeError(f"domain='{domain}' is not registered but function is invoked")
+        raise RuntimeError(f"domain='{domain}' is not registered but function was invoked")
 
     # No CSRF by default, you don't have to add network.api_headers by yourself here
     headers = {}
index ab1aa596c8a1047e792d355435fdb6c1cef5f61e..33f0730802643436ed69ceab6caec2557fc3f3bc 100644 (file)
@@ -33,9 +33,9 @@ def fetch_peers(domain: str) -> list:
     domain_helper.raise_on(domain)
 
     if blacklist.is_blacklisted(domain):
-        raise RuntimeError(f"domain='{domain}' is blacklisted but function is invoked")
+        raise RuntimeError(f"domain='{domain}' is blacklisted but function was invoked")
     elif not instances.is_registered(domain):
-        raise RuntimeError(f"domain='{domain}' is not registered but function is invoked")
+        raise RuntimeError(f"domain='{domain}' is not registered but function was invoked")
 
     # Init variables
     peers   = []
index 74fa3b88a80382842ebc2824d50bf1e41767169e..fea777bb76add049a878ebc4ed5be6cc0f1c0b1e 100644 (file)
@@ -56,9 +56,9 @@ def fetch_blocks(domain: str) -> list:
     domain_helper.raise_on(domain)
 
     if blacklist.is_blacklisted(domain):
-        raise RuntimeError(f"domain='{domain}' is blacklisted but function is invoked")
+        raise RuntimeError(f"domain='{domain}' is blacklisted but function was invoked")
     elif not instances.is_registered(domain):
-        raise RuntimeError(f"domain='{domain}' is not registered but function is invoked")
+        raise RuntimeError(f"domain='{domain}' is not registered but function was invoked")
 
     # Init variables
     blockdict = []
@@ -292,9 +292,9 @@ def fetch_blocks_from_about(domain: str) -> dict:
     domain_helper.raise_on(domain)
 
     if blacklist.is_blacklisted(domain):
-        raise RuntimeError(f"domain='{domain}' is blacklisted but function is invoked")
+        raise RuntimeError(f"domain='{domain}' is blacklisted but function was invoked")
     elif not instances.is_registered(domain):
-        raise RuntimeError(f"domain='{domain}' is not registered but function is invoked")
+        raise RuntimeError(f"domain='{domain}' is not registered but function was invoked")
 
     # Init variables
     doc = None
index 2ef3de68ca4119849b57624e7b9ea1468c59f929..fcb09f011729cfe6287a3e9a752981fcf8c0f600 100644 (file)
@@ -88,7 +88,7 @@ def deobfuscate(domain: str, blocker: str, domain_hash: str = None) -> str:
     domain_helper.raise_on(blocker)
 
     if validators.domain(domain, rfc_2782=True) and blacklist.is_blacklisted(domain):
-        raise ValueError(f"domain='{domain}' is blacklisted but function was invoked")
+        raise RuntimeError(f"domain='{domain}' is blacklisted but function was invoked")
     elif not isinstance(domain_hash, str) and domain_hash is not None:
         raise TypeError(f"Parameter domain_hash[]='{type(domain_hash)}' is not of type 'str'")
     elif domain_hash == "":