Skip to content

Commit

Permalink
import19: add exception handling for drop_and_recreate_index
Browse files Browse the repository at this point in the history
  • Loading branch information
UlrichB22 committed Oct 25, 2024
1 parent c9d4c50 commit 3c856a8
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/moin/cli/migration/moin19/import19.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import os
import re
import sys
import codecs
import importlib
from io import BytesIO
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit 3c856a8

Please sign in to comment.