Display more clean error on users.json/sites.json load error
This commit is contained in:
parent
b6e1559a80
commit
6cd18bbf04
2 changed files with 14 additions and 2 deletions
|
@ -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
|
||||
|
|
|
@ -24,7 +24,13 @@ class UserManager(object):
|
|||
added = 0
|
||||
s = time.time()
|
||||
# Load new users
|
||||
for master_address, data in list(json.load(open("%s/users.json" % config.data_dir)).items()):
|
||||
try:
|
||||
json_path = "%s/users.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 master_address, data in list(data.items()):
|
||||
if master_address not in self.users:
|
||||
user = User(master_address, data=data)
|
||||
self.users[master_address] = user
|
||||
|
|
Loading…
Reference in a new issue