From bbd6d6a5414417d702437ed7091f927f6ff82933 Mon Sep 17 00:00:00 2001 From: Ian McEwen Date: Sat, 28 Sep 2024 20:11:52 -0700 Subject: [PATCH] Change order of logging and parsing fromRadioBytes, and add a bit more traceback logging at that point --- meshtastic/mesh_interface.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/meshtastic/mesh_interface.py b/meshtastic/mesh_interface.py index a70a0db..b0dca56 100644 --- a/meshtastic/mesh_interface.py +++ b/meshtastic/mesh_interface.py @@ -8,6 +8,7 @@ import random import sys import threading import time +import traceback from datetime import datetime from decimal import Decimal from typing import Any, Callable, Dict, List, Optional, Union @@ -1023,10 +1024,17 @@ class MeshInterface: # pylint: disable=R0902 Called by subclasses.""" fromRadio = mesh_pb2.FromRadio() - fromRadio.ParseFromString(fromRadioBytes) logging.debug( f"in mesh_interface.py _handleFromRadio() fromRadioBytes: {fromRadioBytes}" ) + try: + fromRadio.ParseFromString(fromRadioBytes) + except Exception as ex: + logging.error( + f"Error while parsing FromRadio bytes:{fromRadioBytes} {ex}" + ) + traceback.print_exc() + raise ex asDict = google.protobuf.json_format.MessageToDict(fromRadio) logging.debug(f"Received from radio: {fromRadio}") if fromRadio.HasField("my_info"):