diff --git a/pyproject.toml b/pyproject.toml index be249ce..407b2f9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "podping-hivewriter" -version = "1.2.4" +version = "1.2.5" license = "MIT" authors = ["Alecks Gates ", "Brian of London "] maintainers = ["Alecks Gates ", "Brian of London "] diff --git a/src/podping_hivewriter/podping_hivewriter.py b/src/podping_hivewriter/podping_hivewriter.py index 799e3c4..9eac870 100644 --- a/src/podping_hivewriter/podping_hivewriter.py +++ b/src/podping_hivewriter/podping_hivewriter.py @@ -491,18 +491,25 @@ async def failure_retry( except RPCNodeException as ex: logging.exception(f"Failed to send {len(iri_set)} IRIs") try: + # Test if we have a well formed Hive error message + logging.exception(ex) if ( - ex.raw_body["error"]["data"]["name"] - == "tx_missing_posting_auth" + ex.raw_body.get("error") + and ex.raw_body["error"].get("data") + and ex.raw_body["error"]["data"].get("name") ): - if logging.DEBUG >= logging.root.level: - for iri in iri_set: - logging.debug(iri) - logging.error( - f"Terminating: exit code: " - f"{STARTUP_FAILED_INVALID_POSTING_KEY_EXIT_CODE}" - ) - sys.exit(STARTUP_FAILED_INVALID_POSTING_KEY_EXIT_CODE) + if ( + ex.raw_body["error"]["data"]["name"] + == "tx_missing_posting_auth" + ): + if logging.DEBUG >= logging.root.level: + for iri in iri_set: + logging.debug(iri) + logging.error( + f"Terminating: exit code: " + f"{STARTUP_FAILED_INVALID_POSTING_KEY_EXIT_CODE}" + ) + sys.exit(STARTUP_FAILED_INVALID_POSTING_KEY_EXIT_CODE) except Exception: logging.info(f"Current node: {self.lighthive_client.current_node}") logging.info(self.lighthive_client.nodes) @@ -510,6 +517,7 @@ async def failure_retry( sys.exit(STARTUP_FAILED_UNKNOWN_EXIT_CODE) except Exception as ex: + logging.exception(ex) logging.exception(f"Failed to send {len(iri_set)} IRIs") if logging.DEBUG >= logging.root.level: for iri in iri_set: