Don't crash when failing to update note_search DB.

This commit is contained in:
Sergio Martínez Portela 2022-11-01 12:19:52 +01:00
parent 613aa4c88f
commit 847e2cfd74

View File

@ -108,7 +108,13 @@ def load_all(top_dir_relative):
def regen_all(src_top, dest_top, *, docs=None, db=None): def regen_all(src_top, dest_top, *, docs=None, db=None):
files_generated = 0 files_generated = 0
cur = db.cursor() 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) docs = load_all(src_top)
doc_to_headline_remapping = {} doc_to_headline_remapping = {}