Skip to content

Commit 3c856a8

Browse files
committed
import19: add exception handling for drop_and_recreate_index
1 parent c9d4c50 commit 3c856a8

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/moin/cli/migration/moin19/import19.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
import os
1111
import re
12+
import sys
1213
import codecs
1314
import importlib
1415
from io import BytesIO
@@ -272,13 +273,20 @@ def ImportMoin19(data_dir=None, markup_out=None, namespace=None, procs=None, lim
272273
backend.store(meta, out)
273274

274275
logging.info("PHASE4: Rebuilding the index ...")
275-
drop_and_recreate_index(app.storage, procs=procs, limitmb=limitmb, multisegment=True)
276+
msg = ""
277+
try:
278+
drop_and_recreate_index(app.storage, procs=procs, limitmb=limitmb, multisegment=True)
279+
except Exception:
280+
logging.exception("Index build failed. You can try to destroy, create and rebuild the index manually")
281+
msg = " with errors"
276282

277-
logging.info("Finished conversion!")
283+
logging.info(f"Finished conversion{msg}.")
278284
if hasattr(conv_out, "unknown_macro_list"):
279285
migr_statistics(unknown_macros=conv_out.unknown_macro_list)
280286
else:
281287
migr_statistics([])
288+
if msg:
289+
sys.exit(1)
282290

283291

284292
class KillRequested(Exception):

0 commit comments

Comments
 (0)