From 3c856a8bb860fa42a8cd2eba52a2ba802e5e5fe2 Mon Sep 17 00:00:00 2001 From: UlrichB22 <97119703+UlrichB22@users.noreply.github.com> Date: Fri, 25 Oct 2024 20:55:46 +0200 Subject: [PATCH] import19: add exception handling for drop_and_recreate_index --- src/moin/cli/migration/moin19/import19.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/moin/cli/migration/moin19/import19.py b/src/moin/cli/migration/moin19/import19.py index d0651bcff..e494a3534 100644 --- a/src/moin/cli/migration/moin19/import19.py +++ b/src/moin/cli/migration/moin19/import19.py @@ -9,6 +9,7 @@ import os import re +import sys import codecs import importlib from io import BytesIO @@ -272,13 +273,20 @@ def ImportMoin19(data_dir=None, markup_out=None, namespace=None, procs=None, lim backend.store(meta, out) logging.info("PHASE4: Rebuilding the index ...") - drop_and_recreate_index(app.storage, procs=procs, limitmb=limitmb, multisegment=True) + msg = "" + try: + drop_and_recreate_index(app.storage, procs=procs, limitmb=limitmb, multisegment=True) + except Exception: + logging.exception("Index build failed. You can try to destroy, create and rebuild the index manually") + msg = " with errors" - logging.info("Finished conversion!") + logging.info(f"Finished conversion{msg}.") if hasattr(conv_out, "unknown_macro_list"): migr_statistics(unknown_macros=conv_out.unknown_macro_list) else: migr_statistics([]) + if msg: + sys.exit(1) class KillRequested(Exception):