From c495b2d9bedd138af253966f6ee222c72ea7a6cb Mon Sep 17 00:00:00 2001 From: Willem Melching Date: Tue, 31 Mar 2020 14:47:46 -0700 Subject: [PATCH] Tombstone add exception handler --- selfdrive/tombstoned.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/selfdrive/tombstoned.py b/selfdrive/tombstoned.py index eadfbde6dc..d35c3ad290 100755 --- a/selfdrive/tombstoned.py +++ b/selfdrive/tombstoned.py @@ -22,6 +22,7 @@ def report_tombstone(fn, client): f_size = os.path.getsize(fn) if f_size > MAX_SIZE: cloudlog.error(f"Tombstone {fn} too big, {f_size}. Skipping...") + return with open(fn, encoding='ISO-8859-1') as f: contents = f.read() @@ -56,8 +57,11 @@ def main(): now_tombstones = set(get_tombstones()) for fn, ctime in (now_tombstones - initial_tombstones): - cloudlog.info(f"reporting new tombstone {fn}") - report_tombstone(fn, client) + try: + cloudlog.info(f"reporting new tombstone {fn}") + report_tombstone(fn, client) + except Exception: + cloudlog.exception(f"Error reporting tombstone {fn}") initial_tombstones = now_tombstones time.sleep(5)