Put in a fix for aprslib parse exceptions

This patch adds a fix for the aprslib consumer function
to ensure that we don't bail when logging a ParseError
This commit is contained in:
Hemna 2021-08-13 10:31:45 -04:00
parent ed4995b6eb
commit 840c8a990e
1 changed files with 13 additions and 3 deletions

View File

@ -224,11 +224,21 @@ class Aprsdis(aprslib.IS):
self.logger.debug("Server: %s", line.decode("utf8")) self.logger.debug("Server: %s", line.decode("utf8"))
stats.APRSDStats().set_aprsis_keepalive() stats.APRSDStats().set_aprsis_keepalive()
except ParseError as exp: except ParseError as exp:
self.logger.log(11, "%s\n Packet: %s", exp.args[0], exp.args[1]) self.logger.log(
11,
"%s\n Packet: %s",
exp,
exp.packet,
)
except UnknownFormat as exp: except UnknownFormat as exp:
self.logger.log(9, "unknown format %s", exp.args) self.logger.log(
9,
"%s\n Packet: %s",
exp,
exp.packet,
)
except LoginError as exp: except LoginError as exp:
self.logger.error("%s: %s", exp.__class__.__name__, exp.args[0]) self.logger.error("%s: %s", exp.__class__.__name__, exp)
except (KeyboardInterrupt, SystemExit): except (KeyboardInterrupt, SystemExit):
raise raise
except (ConnectionDrop, ConnectionError): except (ConnectionDrop, ConnectionError):