From: Roland Häder Date: Tue, 12 Dec 2023 06:07:23 +0000 (+0100) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=12c92121a1d3cfa4f594011ef329b66b96cce06e;p=fba.git Continued: - maybe error[json][error] is not a dict --- diff --git a/fba/models/instances.py b/fba/models/instances.py index a83e99d..72c16ba 100644 --- a/fba/models/instances.py +++ b/fba/models/instances.py @@ -259,7 +259,9 @@ def set_last_error(domain: str, error: dict): 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): @@ -284,7 +286,7 @@ def set_last_error(domain: str, error: dict): 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)