fix: Refactor code to handle exceptions more gracefully

This commit is contained in:
Paul Gauthier 2024-09-27 12:25:02 -07:00 committed by Paul Gauthier (aider)
parent 6ab1fdfe36
commit 3b9f561956

View file

@ -74,21 +74,15 @@ def get_index():
dname = Path.home() / ".aider" / "caches" / ("help." + __version__)
index = None
if dname.exists():
try:
if dname.exists():
storage_context = StorageContext.from_defaults(
persist_dir=dname,
)
index = load_index_from_storage(storage_context)
except (OSError, json.JSONDecodeError):
shutil.rmtree(dname)
pass
storage_context = StorageContext.from_defaults(
persist_dir=dname,
)
index = load_index_from_storage(storage_context)
else:
if index is None:
parser = MarkdownNodeParser()