Display more clean error on users.json/sites.json load error

This commit is contained in:
shortcutme 2019-08-07 14:11:30 +02:00
parent b6e1559a80
commit 6cd18bbf04
No known key found for this signature in database
GPG key ID: 5B63BAE6CB9613AE
2 changed files with 14 additions and 2 deletions

View file

@ -33,7 +33,13 @@ class SiteManager(object):
address_found = []
added = 0
# Load new adresses
for address, settings in json.load(open("%s/sites.json" % config.data_dir)).items():
try:
json_path = "%s/sites.json" % config.data_dir
data = json.load(open(json_path))
except Exception as err:
raise Exception("Unable to load %s: %s" % (json_path, err))
for address, settings in data.items():
if address not in self.sites:
if os.path.isfile("%s/%s/content.json" % (config.data_dir, address)):
# Root content.json exists, try load site