added try except block
This commit is contained in:
parent
f6a3f79220
commit
eca5bba1d8
@ -26,6 +26,7 @@ def ccsds_tm_handler(apid: int, raw_tm_packet: bytearray, tmtc_printer: TmTcPrin
|
||||
def pus_factory_hook(raw_tm_packet: bytearray, tmtc_printer: TmTcPrinter):
|
||||
service_type = raw_tm_packet[7]
|
||||
tm_packet = None
|
||||
try:
|
||||
if service_type == 1:
|
||||
tm_packet = Service1TMExtended.unpack(raw_telemetry=raw_tm_packet)
|
||||
if service_type == 3:
|
||||
@ -40,3 +41,6 @@ def pus_factory_hook(raw_tm_packet: bytearray, tmtc_printer: TmTcPrinter):
|
||||
LOGGER.info(f'The service {service_type} is not implemented in Telemetry Factory')
|
||||
tm_packet = PusTelemetry.unpack(raw_telemetry=raw_tm_packet)
|
||||
tmtc_printer.print_telemetry(packet_if=tm_packet, info_if=tm_packet, print_raw_tm=False)
|
||||
except ValueError:
|
||||
# TODO: Log faulty packet
|
||||
LOGGER.warning("Invalid packet format detected")
|
||||
|
Loading…
Reference in New Issue
Block a user