From 847e2cfd7403ddef7eacf311e9cdee97e6904cc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20Mart=C3=ADnez=20Portela?= Date: Tue, 1 Nov 2022 12:19:52 +0100 Subject: [PATCH] Don't crash when failing to update note_search DB. --- scripts/generate.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/generate.py b/scripts/generate.py index 2ca6882..e9bed85 100644 --- a/scripts/generate.py +++ b/scripts/generate.py @@ -108,7 +108,13 @@ def load_all(top_dir_relative): def regen_all(src_top, dest_top, *, docs=None, db=None): files_generated = 0 cur = db.cursor() - cur.execute('DELETE FROM note_search;') + cleaned_db = False + + try: + cur.execute('DELETE FROM note_search;') + cleaned_db = True + except sqlite3.OperationalError as err: + logging.warn("Error pre-cleaning DB, search won't be updated") docs = load_all(src_top) doc_to_headline_remapping = {}