fix: add error handling to load_config
This commit is contained in:
@@ -7,8 +7,11 @@ CONFIG_PATH = os.path.join(os.path.dirname(__file__), 'config.json')
|
|||||||
|
|
||||||
def load_config():
|
def load_config():
|
||||||
if os.path.exists(CONFIG_PATH):
|
if os.path.exists(CONFIG_PATH):
|
||||||
with open(CONFIG_PATH, 'r') as f:
|
try:
|
||||||
return json.load(f)
|
with open(CONFIG_PATH, 'r') as f:
|
||||||
|
return json.load(f)
|
||||||
|
except (json.JSONDecodeError, IOError):
|
||||||
|
return {"server_url": "http://localhost:5000", "default_expiry": "24h"}
|
||||||
return {"server_url": "http://localhost:5000", "default_expiry": "24h"}
|
return {"server_url": "http://localhost:5000", "default_expiry": "24h"}
|
||||||
|
|
||||||
def save_config(config):
|
def save_config(config):
|
||||||
|
|||||||
Reference in New Issue
Block a user