Skip to content

Commit

Permalink
less crashy
Browse files Browse the repository at this point in the history
  • Loading branch information
robotastic committed Jan 16, 2025
1 parent aa75b3b commit 3821b55
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions skyscan-c2/c2_pub_sub.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""
import os
import json
from json import JSONDecodeError
import logging
from io import StringIO
from time import sleep, time
Expand Down Expand Up @@ -346,11 +347,11 @@ def decode_payload(
try:
json_payload = json.loads(payload)
data_payload = json_payload[data_payload_type]
except (KeyError, TypeError) as e:
except (KeyError, TypeError, JSONDecodeError, json.JSONDecodeError) as e:
logging.error(f"Error: {e}")
logging.error(json_payload)
logging.error(payload)
logging.error(
f"Data payload type: {data_payload_type} not found in payload: {data_payload}"
f"Data payload type: {data_payload_type} not found in payload: {payload}"
)
return {}
return json.loads(data_payload)
Expand Down

0 comments on commit 3821b55

Please sign in to comment.