forked from indymedia/epicyon
Catch all commentjson load errors
parent
5f94b413a7
commit
e7f377698a
|
@ -326,9 +326,9 @@ def addHtmlTags(baseDir: str,httpPrefix: str, \
|
||||||
if emojiDictCtr>0:
|
if emojiDictCtr>0:
|
||||||
print('emojiDict loaded on try '+str(emojiDictCtr))
|
print('emojiDict loaded on try '+str(emojiDictCtr))
|
||||||
break
|
break
|
||||||
except (IndexError, AttributeError, commentjson.JSONLibraryException) as e:
|
except:
|
||||||
print('WARN: commentjson exception addHtmlTags - '+str(e))
|
print('WARN: commentjson exception addHtmlTags')
|
||||||
print('Failed to load emoji (try '+str(emojiDictCtr)+'): '+baseDir+'/emoji/emoji.json '+str(e))
|
print('Failed to load emoji (try '+str(emojiDictCtr)+'): '+baseDir+'/emoji/emoji.json')
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
emojiDictCtr+=1
|
emojiDictCtr+=1
|
||||||
|
|
||||||
|
|
4
inbox.py
4
inbox.py
|
@ -1727,9 +1727,9 @@ def runInboxQueue(projectVersion: str, \
|
||||||
try:
|
try:
|
||||||
with open(queueFilename, 'r') as fp:
|
with open(queueFilename, 'r') as fp:
|
||||||
queueJson=commentjson.load(fp)
|
queueJson=commentjson.load(fp)
|
||||||
except (IndexError, AttributeError, commentjson.JSONLibraryException) as e:
|
except:
|
||||||
itemReadFailed+=1
|
itemReadFailed+=1
|
||||||
print('WARN: commentjson exception runInboxQueue - '+str(e))
|
print('WARN: commentjson exception runInboxQueue')
|
||||||
print('WARN: Failed to load inbox queue item '+queueFilename+' (try '+str(itemReadFailed)+')')
|
print('WARN: Failed to load inbox queue item '+queueFilename+' (try '+str(itemReadFailed)+')')
|
||||||
if itemReadFailed>4:
|
if itemReadFailed>4:
|
||||||
# After a few tries we can assume that the file
|
# After a few tries we can assume that the file
|
||||||
|
|
8
posts.py
8
posts.py
|
@ -1927,8 +1927,8 @@ def createSharedInboxIndex(baseDir: str,sharedBoxDir: str, \
|
||||||
try:
|
try:
|
||||||
with open(sharedInboxFilename, 'r') as fp:
|
with open(sharedInboxFilename, 'r') as fp:
|
||||||
postJsonObject=commentjson.load(fp)
|
postJsonObject=commentjson.load(fp)
|
||||||
except (IndexError, AttributeError, commentjson.JSONLibraryException) as e:
|
except:
|
||||||
print('WARN: commentjson exception createBoxBase - '+str(e))
|
print('WARN: commentjson exception createBoxBase')
|
||||||
continue
|
continue
|
||||||
|
|
||||||
actorNickname=getNicknameFromActor(postJsonObject['actor'])
|
actorNickname=getNicknameFromActor(postJsonObject['actor'])
|
||||||
|
@ -1963,8 +1963,8 @@ def createSharedInboxIndex(baseDir: str,sharedBoxDir: str, \
|
||||||
with open(ocapFilename, 'r') as fp:
|
with open(ocapFilename, 'r') as fp:
|
||||||
ocapJson=commentjson.load(fp)
|
ocapJson=commentjson.load(fp)
|
||||||
loadedOcap=True
|
loadedOcap=True
|
||||||
except (IndexError, AttributeError, commentjson.JSONLibraryException) as e:
|
except:
|
||||||
print('WARN: commentjson exception createBoxBase - '+str(e))
|
print('WARN: commentjson exception createBoxBase')
|
||||||
|
|
||||||
if loadedOcap:
|
if loadedOcap:
|
||||||
if ocapJson.get('id'):
|
if ocapJson.get('id'):
|
||||||
|
|
12
utils.py
12
utils.py
|
@ -37,8 +37,8 @@ def loadJson(filename: str) -> {}:
|
||||||
with open(filename, 'r') as fp:
|
with open(filename, 'r') as fp:
|
||||||
jsonObject=commentjson.load(fp)
|
jsonObject=commentjson.load(fp)
|
||||||
break
|
break
|
||||||
except (IndexError, AttributeError, commentjson.JSONLibraryException) as e:
|
except:
|
||||||
print('WARN: loadJson exception - '+str(e))
|
print('WARN: loadJson exception')
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
tries+=1
|
tries+=1
|
||||||
return jsonObject
|
return jsonObject
|
||||||
|
@ -127,8 +127,8 @@ def getDisplayName(baseDir: str,actor: str,personCache: {}) -> str:
|
||||||
with open(cachedActorFilename, 'r') as fp:
|
with open(cachedActorFilename, 'r') as fp:
|
||||||
actorJson=commentjson.load(fp)
|
actorJson=commentjson.load(fp)
|
||||||
break
|
break
|
||||||
except (IndexError, AttributeError, commentjson.JSONLibraryException) as e:
|
except:
|
||||||
print('WARN: getDisplayName '+str(e))
|
print('WARN: getDisplayName')
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
tries+=1
|
tries+=1
|
||||||
if actorJson:
|
if actorJson:
|
||||||
|
@ -300,8 +300,8 @@ def deletePost(baseDir: str,httpPrefix: str,nickname: str,domain: str,postFilena
|
||||||
with open(postFilename, 'r') as fp:
|
with open(postFilename, 'r') as fp:
|
||||||
postJsonObject=commentjson.load(fp)
|
postJsonObject=commentjson.load(fp)
|
||||||
break
|
break
|
||||||
except (IndexError, AttributeError, commentjson.JSONLibraryException) as e:
|
except:
|
||||||
print('WARN: deletePost '+str(e))
|
print('WARN: deletePost')
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
tries+=1
|
tries+=1
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue