if blacklist.is_blacklisted(domain):
raise ValueError(f"domain='{domain}' is blacklisted but function was invoked")
elif not _write_error_log:
- logger.debug("Writing to error_log is disabled in configuruation file - EXIT!")
- return
+ raise Exception("Logging of errors is disabled but function was invoked")
logger.debug("error[]='%s' - BEFORE!", type(error))
if isinstance(error, (BaseException, json.decoder.JSONDecodeError)):
_config = {
"recheck_block" : config.get("recheck_block"),
"recheck_instance": config.get("recheck_instance"),
+ "write_error_log" : config.get("write_error_log"),
}
def _set_data(key: str, domain: str, value: any) -> None:
_set_data("last_status_code" , domain, error["status_code"])
_set_data("last_error_details", domain, error["json"]["error"] if error["json"]["error"] != "" else None)
- logger.debug("Invoking error_log.add(domain='%s',error[]='%s'", domain, type(error))
- error_log.add(domain, error)
+ if _config["write_error_log"]:
+ logger.debug("Invoking error_log.add(domain='%s',error[]='%s'", domain, type(error))
+ error_log.add(domain, error)
logger.debug("EXIT!")