From 97e83d2bea87a21dff3f72d01c7b58db1dd2d761 Mon Sep 17 00:00:00 2001 From: echoDaveD Date: Wed, 12 Feb 2025 17:36:48 +0100 Subject: [PATCH] fixing ValueError and better logging for determine_value try catch --- MessageProcessor.py | 2 +- NASAPacket.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/MessageProcessor.py b/MessageProcessor.py index a91957a..d091077 100644 --- a/MessageProcessor.py +++ b/MessageProcessor.py @@ -76,7 +76,7 @@ class MessageProcessor: try: msgvalue = self.determine_value(msg.packet_payload, msgname) except Exception as e: - raise MessageWarningException(argument=msg['payload'], message=f"Value of {hexmsg:<6} couldn't be determinate, skip Message {e}") + raise MessageWarningException(argument=msg.packet_payload, message=f"Value of {hexmsg} couldn't be determinate, skip Message {e}") self.protocolMessage(msg, msgname, msgvalue) else: logger.debug(f"Message not Found in NASA repository: {hexmsg:<6} Type: {msg.packet_message_type} Payload: {msg.packet_payload}") diff --git a/NASAPacket.py b/NASAPacket.py index e9d150b..e42f771 100644 --- a/NASAPacket.py +++ b/NASAPacket.py @@ -259,9 +259,9 @@ class NASAPacket: elif message_type == 3: payload_size = len(msg_rest) if capacity != 1: - raise ValueError(message="Message with structure type must have capacity of 1.") + raise ValueError("Message with structure type must have capacity of 1.") else: - raise ValueError(message=f"Mssage type unknown: {message_type}") + raise ValueError(f"Mssage type unknown: {message_type}") payload = msg_rest[2:2 + payload_size] if len(payload) > 255: