Moved error handling for one thing since I want to handle it separately

This commit is contained in:
Frisk 2020-09-08 21:13:42 +02:00
parent 7808c4b47d
commit 75a865287f
No known key found for this signature in database
GPG key ID: 213F7C15068AF8AC

View file

@ -227,8 +227,6 @@ async def scan_group(group: str):
await local_wiki.fail_add(queued_wiki.url, 410)
continue
raise WikiError
recent_changes = recent_changes_resp['query']['recentchanges']
recent_changes.reverse()
except aiohttp.ContentTypeError:
logger.exception("Wiki seems to be resulting in non-json content.")
await local_wiki.fail_add(queued_wiki.url, 410)
@ -236,6 +234,12 @@ async def scan_group(group: str):
except:
logger.exception("On loading json of response.")
continue
try:
recent_changes = recent_changes_resp['query']['recentchanges']
recent_changes.reverse()
except KeyError:
logger.error("recent_changes_resp returned KeyError. skipping this check. (usually this happens when the wiki doesn't respond properly, it's pretty normal)")
continue
if extended:
await process_mwmsgs(recent_changes_resp, local_wiki, mw_msgs)
if local_wiki.rc_active in (0, None, -1): # new wiki, just get the last rc to not spam the channel, -1 for -1 to NULL changes