Better error message
This commit is contained in:
parent
f66c489fc6
commit
a72ccd4b26
@ -13,7 +13,7 @@ def loadSettings(path: str | None) -> dict:
|
|||||||
Load the settings file.
|
Load the settings file.
|
||||||
|
|
||||||
`path` Path to a 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:
|
if path is None:
|
||||||
@ -22,6 +22,11 @@ def loadSettings(path: str | None) -> dict:
|
|||||||
if not os.path.exists(path):
|
if not os.path.exists(path):
|
||||||
path = '/etc/dyn-gandi.json'
|
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):
|
if not os.path.exists(path):
|
||||||
print(f"[ERROR] '{path}' does not exist.")
|
print(f"[ERROR] '{path}' does not exist.")
|
||||||
quit()
|
quit()
|
||||||
|
Loading…
Reference in New Issue
Block a user