Skip to content

Commit

Permalink
107 more descriptive error again
Browse files Browse the repository at this point in the history
  • Loading branch information
panyab committed Mar 8, 2024
1 parent a3ff84f commit 52096cc
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions EosLib/packet/packet.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,10 @@ def decode(packet_bytes: bytes):
decoded_data_header = decoded_data_header
packet_bytes = packet_bytes[struct.calcsize(DataHeader.data_header_struct_format_string):]
else:
decoded_data_header = DataHeader(sender=Device.RADIO, data_type=Type.EMPTY)
#raise PacketFormatError(f"Packet does not contain a header. Unexpected packet header: {packet_bytes[0]}, should be: {HeaderPreamble.DATA}")
decoded_data_header = DataHeader.decode(
packet_bytes[0:struct.calcsize(DataHeader.data_header_struct_format_string)])
raise PacketFormatError(f"Packet does not contain a header. Unexpected packet header: {packet_bytes[0]}, \
should be: {HeaderPreamble.DATA}. Decoded header: {decoded_data_header}")

decoded_packet = Packet(EosLib.format.decode_factory.decode_factory.decode(decoded_data_header.data_type,
packet_bytes),
Expand Down

0 comments on commit 52096cc

Please sign in to comment.