From c543b00aa60cc7e3c3d04edd126d2bc1984cfabf Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Sun, 26 Sep 2021 12:24:40 -0400 Subject: [PATCH] motan: Improve handling of errors during data subscriptions Signed-off-by: Kevin O'Connor --- scripts/motan/data_logger.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/motan/data_logger.py b/scripts/motan/data_logger.py index cd64e465..591644c1 100755 --- a/scripts/motan/data_logger.py +++ b/scripts/motan/data_logger.py @@ -159,6 +159,10 @@ class DataLogger: {"sensor": aname}) def handle_dump(self, msg, raw_msg): msg_id = msg["id"] + if "result" not in msg: + self.error("Unable to subscribe to '%s': %s" + % (msg_id, msg.get("error", {}).get("message", ""))) + return self.db.setdefault("subscriptions", {})[msg_id] = msg["result"] def flush_index(self): self.db['file_position'] = self.logger.flush()