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:
|
||||
print('emojiDict loaded on try '+str(emojiDictCtr))
|
||||
break
|
||||
except (IndexError, AttributeError, 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))
|
||||
except:
|
||||
print('WARN: commentjson exception addHtmlTags')
|
||||
print('Failed to load emoji (try '+str(emojiDictCtr)+'): '+baseDir+'/emoji/emoji.json')
|
||||
time.sleep(1)
|
||||
emojiDictCtr+=1
|
||||
|
||||
|
|
4
inbox.py
4
inbox.py
|
@ -1727,9 +1727,9 @@ def runInboxQueue(projectVersion: str, \
|
|||
try:
|
||||
with open(queueFilename, 'r') as fp:
|
||||
queueJson=commentjson.load(fp)
|
||||
except (IndexError, AttributeError, commentjson.JSONLibraryException) as e:
|
||||
except:
|
||||
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)+')')
|
||||
if itemReadFailed>4:
|
||||
# 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:
|
||||
with open(sharedInboxFilename, 'r') as fp:
|
||||
postJsonObject=commentjson.load(fp)
|
||||
except (IndexError, AttributeError, commentjson.JSONLibraryException) as e:
|
||||
print('WARN: commentjson exception createBoxBase - '+str(e))
|
||||
except:
|
||||
print('WARN: commentjson exception createBoxBase')
|
||||
continue
|
||||
|
||||
actorNickname=getNicknameFromActor(postJsonObject['actor'])
|
||||
|
@ -1963,8 +1963,8 @@ def createSharedInboxIndex(baseDir: str,sharedBoxDir: str, \
|
|||
with open(ocapFilename, 'r') as fp:
|
||||
ocapJson=commentjson.load(fp)
|
||||
loadedOcap=True
|
||||
except (IndexError, AttributeError, commentjson.JSONLibraryException) as e:
|
||||
print('WARN: commentjson exception createBoxBase - '+str(e))
|
||||
except:
|
||||
print('WARN: commentjson exception createBoxBase')
|
||||
|
||||
if loadedOcap:
|
||||
if ocapJson.get('id'):
|
||||
|
|
12
utils.py
12
utils.py
|
@ -37,8 +37,8 @@ def loadJson(filename: str) -> {}:
|
|||
with open(filename, 'r') as fp:
|
||||
jsonObject=commentjson.load(fp)
|
||||
break
|
||||
except (IndexError, AttributeError, commentjson.JSONLibraryException) as e:
|
||||
print('WARN: loadJson exception - '+str(e))
|
||||
except:
|
||||
print('WARN: loadJson exception')
|
||||
time.sleep(2)
|
||||
tries+=1
|
||||
return jsonObject
|
||||
|
@ -127,8 +127,8 @@ def getDisplayName(baseDir: str,actor: str,personCache: {}) -> str:
|
|||
with open(cachedActorFilename, 'r') as fp:
|
||||
actorJson=commentjson.load(fp)
|
||||
break
|
||||
except (IndexError, AttributeError, commentjson.JSONLibraryException) as e:
|
||||
print('WARN: getDisplayName '+str(e))
|
||||
except:
|
||||
print('WARN: getDisplayName')
|
||||
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 (IndexError, AttributeError, commentjson.JSONLibraryException) as e:
|
||||
print('WARN: deletePost '+str(e))
|
||||
except:
|
||||
print('WARN: deletePost')
|
||||
time.sleep(1)
|
||||
tries+=1
|
||||
|
||||
|
|
Loading…
Reference in New Issue