Skip to content

Commit

Permalink
Skip json.decoder.JSONDecodeError caused by OpenMHz (#79)
Browse files Browse the repository at this point in the history
  • Loading branch information
mpuckett159 authored Oct 19, 2021
1 parent 339d529 commit a7d36ae
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions signal_scanner_bot/transport.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Main module."""
import asyncio
import json
import logging
import subprocess
from datetime import date, datetime, timedelta
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit a7d36ae

Please sign in to comment.