from fba import database
+from fba.helpers import blacklist
from fba.helpers import config
from fba.helpers import domain as domain_helper
def add(domain: str, error: dict):
logger.debug("domain='%s',error[]='%s' - CALLED!", domain, type(error))
domain_helper.raise_on(domain)
- if config.get("write_error_log").lower() != "true":
+
+ if blacklist.is_blacklisted(domain):
+ raise ValueError(f"domain='{domain}' is blacklisted but function was invoked")
+ elif config.get("write_error_log").lower() != "true":
logger.debug("Writing to error_log is disabled in configuruation file - EXIT!")
return
logger.debug("error[]='%s' - BEFORE!", type(error))
- if isinstance(error, BaseException, error, json.decoder.JSONDecodeError):
+ if isinstance(error, (BaseException, json.decoder.JSONDecodeError)):
error = f"error[{type(error)}]='{str(error)}'"
logger.debug("error[]='%s' - AFTER!", type(error))