From 9a84e191be61d50d85d72863671a68ceccab8252 Mon Sep 17 00:00:00 2001 From: "Peter J. Holzer" Date: Fri, 24 May 2024 22:32:25 +0200 Subject: [PATCH] Log files with invalid JSON --- ltsdb_json.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ltsdb_json.py b/ltsdb_json.py index d943642..b123668 100644 --- a/ltsdb_json.py +++ b/ltsdb_json.py @@ -42,6 +42,9 @@ class LTS: fcntl.flock(fh, fcntl.LOCK_EX) json.dump({"description": self.description, "data": self.data}, fh) self.rebuild_index() + except json.decoder.JSONDecodeError as e: + log.exception(f"Cannot decode JSON in {self.filename}: {e}") + raise def pop(self, i): # Pop the element at index i and adjust the min/max values of the