diff --git a/signal_scanner_bot/transport.py b/signal_scanner_bot/transport.py index 504b3f7..487373e 100644 --- a/signal_scanner_bot/transport.py +++ b/signal_scanner_bot/transport.py @@ -1,5 +1,6 @@ """Main module.""" import asyncio +import json import logging import subprocess from datetime import date, datetime, timedelta @@ -158,6 +159,11 @@ async def radio_monitor_alert_transport() -> None: f"Sleeping for {env.RADIO_MONITOR_LOOKBACK}s before checking for monitored unit alerts again." ) await asyncio.sleep(env.RADIO_MONITOR_LOOKBACK) + except json.decoder.JSONDecodeError: + # Sometimes OpenMHz doesn't return properly and the Python json library throws this error. + # It is transient and so doesn't really need to panic or throw an exception, so we will + # ignore it. + pass except Exception as err: log.exception(err) signal.panic(err)