protect against parser errors to prevent queue backlogging
This commit is contained in:
parent
68a1abd37e
commit
a0d219d120
@ -1,10 +1,17 @@
|
||||
from owrx.parser import Parser
|
||||
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class PocsagParser(Parser):
|
||||
def parse(self, raw):
|
||||
fields = raw.decode("ascii", "replace").rstrip("\n").split(";")
|
||||
meta = {v[0]: "".join(v[1:]) for v in map(lambda x: x.split(":"), fields) if v[0] != ""}
|
||||
if "address" in meta:
|
||||
meta["address"] = int(meta["address"])
|
||||
self.handler.write_pocsag_data(meta)
|
||||
try:
|
||||
fields = raw.decode("ascii", "replace").rstrip("\n").split(";")
|
||||
meta = {v[0]: "".join(v[1:]) for v in map(lambda x: x.split(":"), fields) if v[0] != ""}
|
||||
if "address" in meta:
|
||||
meta["address"] = int(meta["address"])
|
||||
self.handler.write_pocsag_data(meta)
|
||||
except Exception:
|
||||
logger.exception("Exception while parsing Pocsag message")
|
||||
|
@ -176,8 +176,8 @@ class WsjtParser(Parser):
|
||||
ReportingEngine.getSharedInstance().spot(out)
|
||||
|
||||
self.handler.write_wsjt_message(out)
|
||||
except (ValueError, IndexError):
|
||||
logger.exception("error while parsing wsjt message")
|
||||
except Exception:
|
||||
logger.exception("Exception while parsing wsjt message")
|
||||
|
||||
def pushDecode(self, mode):
|
||||
metrics = Metrics.getSharedInstance()
|
||||
|
Loading…
Reference in New Issue
Block a user