commentjson exceptions

main2
Bob Mottram 2019-10-26 13:19:34 +01:00
parent c3c26ad2e9
commit cf2be50b48
4 changed files with 11 additions and 11 deletions

View File

@ -326,7 +326,7 @@ def addHtmlTags(baseDir: str,httpPrefix: str, \
if emojiDictCtr>0:
print('emojiDict loaded on try '+str(emojiDictCtr))
break
except Exception as e:
except commentjson.JSONLibraryException as e:
print('WARN: commentjson exception addHtmlTags - '+str(e))
print('Failed to load emoji (try '+str(emojiDictCtr)+'): '+baseDir+'/emoji/emoji.json '+str(e))
time.sleep(1)

View File

@ -1727,7 +1727,7 @@ def runInboxQueue(projectVersion: str, \
try:
with open(queueFilename, 'r') as fp:
queueJson=commentjson.load(fp)
except Exception as e:
except commentjson.JSONLibraryException as e:
itemReadFailed+=1
print('WARN: commentjson exception runInboxQueue - '+str(e))
print('WARN: Failed to load inbox queue item '+queueFilename+' (try '+str(itemReadFailed)+')')

View File

@ -1927,7 +1927,7 @@ def createSharedInboxIndex(baseDir: str,sharedBoxDir: str, \
try:
with open(sharedInboxFilename, 'r') as fp:
postJsonObject=commentjson.load(fp)
except Exception as e:
except commentjson.JSONLibraryException as e:
print('WARN: commentjson exception createBoxBase - '+str(e))
continue
@ -1963,7 +1963,7 @@ def createSharedInboxIndex(baseDir: str,sharedBoxDir: str, \
with open(ocapFilename, 'r') as fp:
ocapJson=commentjson.load(fp)
loadedOcap=True
except Exception as e:
except commentjson.JSONLibraryException as e:
print('WARN: commentjson exception createBoxBase - '+str(e))
if loadedOcap:

View File

@ -21,8 +21,8 @@ def saveJson(jsonObject: {},filename: str) -> bool:
with open(filename, 'w') as fp:
commentjson.dump(jsonObject, fp, indent=2, sort_keys=False)
return True
except Exception as e:
print(e)
except commentjson.JSONLibraryException as e:
print('WARN: saveJson '+str(e))
time.sleep(1)
tries+=1
return False
@ -37,7 +37,7 @@ def loadJson(filename: str) -> {}:
with open(filename, 'r') as fp:
jsonObject=commentjson.load(fp)
break
except Exception as e:
except commentjson.JSONLibraryException as e:
print('WARN: loadJson exception - '+str(e))
time.sleep(2)
tries+=1
@ -127,8 +127,8 @@ def getDisplayName(baseDir: str,actor: str,personCache: {}) -> str:
with open(cachedActorFilename, 'r') as fp:
actorJson=commentjson.load(fp)
break
except Exception as e:
print(e)
except commentjson.JSONLibraryException as e:
print('WARN: getDisplayName '+str(e))
time.sleep(1)
tries+=1
if actorJson:
@ -300,8 +300,8 @@ def deletePost(baseDir: str,httpPrefix: str,nickname: str,domain: str,postFilena
with open(postFilename, 'r') as fp:
postJsonObject=commentjson.load(fp)
break
except Exception as e:
print(e)
except commentjson.JSONLibraryException as e:
print('WARN: deletePost '+str(e))
time.sleep(1)
tries+=1