logger.debug("error[]='%s' - BEFORE!", type(error))
if isinstance(error, (BaseException, json.decoder.JSONDecodeError)):
+ logger.debug("error[]='%s' is an exception, converting to string ...", type(error))
error = f"error[{type(error)}]='{str(error)}'"
+
logger.debug("error[]='%s' - AFTER!", type(error))
if isinstance(error, str):
logger.debug("Setting last_error_details='%s' (json,error)", error["json"]["error_message"])
_set_data("last_status_code" , domain, error["status_code"])
_set_data("last_error_details", domain, error["json"]["error_message"] if error["json"]["error_message"] != "" else None)
- elif "json" in error and "error" in error["json"] and "message" in error["json"]["error"]:
+ elif "json" in error and "error" in error["json"] and isinstance(error["json"]["error"], dict) and "message" in error["json"]["error"]:
logger.debug("Setting last_error_details='%s' (json,error)", error["json"]["error"]["message"])
_set_data("last_status_code" , domain, error["status_code"])
_set_data("last_error_details", domain, error["json"]["error"]["message"] if error["json"]["error"]["message"] != "" else None)