Merge pull request #305 from barrabinfc/master
- Handle Exception for invalid dbschema.json files (siteSign)
This commit is contained in:
commit
6cbb6adcfc
2 changed files with 6 additions and 2 deletions
|
@ -34,8 +34,12 @@ class SiteStorage:
|
||||||
|
|
||||||
# Load db from dbschema.json
|
# Load db from dbschema.json
|
||||||
def openDb(self, check=True):
|
def openDb(self, check=True):
|
||||||
schema = self.loadJson("dbschema.json")
|
try:
|
||||||
db_path = self.getPath(schema["db_file"])
|
schema = self.loadJson("dbschema.json")
|
||||||
|
db_path = self.getPath(schema["db_file"])
|
||||||
|
except Exception, err:
|
||||||
|
raise Exception("dbschema.json is not a valid JSON: %s" % err)
|
||||||
|
|
||||||
if check:
|
if check:
|
||||||
if not os.path.isfile(db_path) or os.path.getsize(db_path) == 0: # Not exist or null
|
if not os.path.isfile(db_path) or os.path.getsize(db_path) == 0: # Not exist or null
|
||||||
self.rebuildDb()
|
self.rebuildDb()
|
||||||
|
|
0
zeronet.py
Normal file → Executable file
0
zeronet.py
Normal file → Executable file
Loading…
Reference in a new issue