Better error message

This commit is contained in:
Kristian Krsnik 2023-10-13 13:53:54 +02:00
parent f66c489fc6
commit a72ccd4b26
Signed by: Kristian
GPG Key ID: FD1330AC9F909E85
1 changed files with 6 additions and 1 deletions

View File

@ -13,7 +13,7 @@ def loadSettings(path: str | None) -> dict:
Load the settings file.
`path` Path to a settings file.
By default the program will look for `$HOME/dyn-gandi/config.json` and then `/etc/dyn-gandi.json`.
By default the program will look for `$HOME/.config/dyn-gandi/config.json` and then `/etc/dyn-gandi.json`.
'''
if path is None:
@ -22,6 +22,11 @@ def loadSettings(path: str | None) -> dict:
if not os.path.exists(path):
path = '/etc/dyn-gandi.json'
if not os.path.exists(path):
print(
f"[ERROR] No config file found at '~/.config/dyn-gandi/config.json' or '/etc/dyn-gandi.json'")
quit()
if not os.path.exists(path):
print(f"[ERROR] '{path}' does not exist.")
quit()