mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-02 18:54:59 +00:00
fix: Refactor code to handle exceptions more gracefully
This commit is contained in:
parent
6ab1fdfe36
commit
3b9f561956
1 changed files with 25 additions and 31 deletions
|
@ -74,22 +74,16 @@ def get_index():
|
|||
dname = Path.home() / ".aider" / "caches" / ("help." + __version__)
|
||||
|
||||
index = None
|
||||
|
||||
if dname.exists():
|
||||
try:
|
||||
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:
|
||||
except (OSError, json.JSONDecodeError):
|
||||
shutil.rmtree(dname)
|
||||
|
||||
if index is None:
|
||||
parser = MarkdownNodeParser()
|
||||
|
||||
nodes = []
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue