Skip to content

Commit c6a75ef

Browse files
committed
Wrap bullshit exception causing log msg in a try block
1 parent 57e7789 commit c6a75ef

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/cync-lan.py

+8-3
Original file line numberDiff line numberDiff line change
@@ -2860,9 +2860,14 @@ async def parse_packet(self, data: bytes):
28602860
calc_chksum = self.first_83_packet_checksum
28612861
else:
28622862
self.first_83_packet_checksum = None
2863-
2864-
if calc_chksum != checksum:
2865-
logger.warning(f"{bad_chksum_msg}\n\nHEX: {packet_data[1:-1].hex(' ')}\nINT: {bytes2list(packet_data[1:-1])}")
2863+
# no clue how this is supposedly an unbound var with no value when it is clearly not
2864+
# wrap it in try and follow the traceback
2865+
try:
2866+
if calc_chksum != checksum:
2867+
logger.warning(f"{bad_chksum_msg}\n\nHEX: {packet_data[1:-1].hex(' ')}\nINT: {bytes2list(packet_data[1:-1])}")
2868+
except Exception as e:
2869+
logger.exception(f"\n\n\nDEBUG>>> {e}\n\n")
2870+
logger.warning(f"HEX: {packet_data[1:-1].hex(' ')}\nINT: {bytes2list(packet_data[1:-1])}")
28662871

28672872

28682873
id_idx = 14 if add_one is False else 15

0 commit comments

Comments
 (0)