mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-31 01:35:00 +00:00
fix: Improve error handling in load_dotenv_files function
This commit is contained in:
parent
25c3a959dd
commit
d063be23c9
1 changed files with 6 additions and 6 deletions
|
@ -274,14 +274,14 @@ def load_dotenv_files(git_root, dotenv_fname, encoding="utf-8"):
|
||||||
)
|
)
|
||||||
loaded = []
|
loaded = []
|
||||||
for fname in dotenv_files:
|
for fname in dotenv_files:
|
||||||
if Path(fname).exists():
|
try:
|
||||||
try:
|
if Path(fname).exists():
|
||||||
load_dotenv(fname, override=True, encoding=encoding)
|
load_dotenv(fname, override=True, encoding=encoding)
|
||||||
loaded.append(fname)
|
loaded.append(fname)
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
print(f"OSError loading {fname}: {e}")
|
print(f"OSError loading {fname}: {e}")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Error loading {fname}: {e}")
|
print(f"Error loading {fname}: {e}")
|
||||||
return loaded
|
return loaded
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue