The background task we create to update off-topic names at midnight UTC fails if it receives a non-success API response. The reason is that our bot.api_client will raise the bot.api.ResponseCodeError exception on non-success response status codes. This means that the off-topic channel names won't be updated again until either the bot is restarted or the task is started manually again by an admin.
The relevant lines of code:
|
channel_0_name, channel_1_name, channel_2_name = await bot.api_client.get( |
|
'bot/off-topic-channel-names', params={'random_items': 3} |
|
) |
To handle it, we could simply include a try-except block and log the exception in the except block. I'm not sure if we want to log the entire exception, since the exception text could be a massive HTML-response generated by cloudflare. Logging the failure with the response code should generally give us enough to determine the cause of the failure.
The background task we create to update off-topic names at midnight UTC fails if it receives a non-success API response. The reason is that our
bot.api_clientwill raise thebot.api.ResponseCodeErrorexception on non-success response status codes. This means that the off-topic channel names won't be updated again until either the bot is restarted or the task is started manually again by an admin.The relevant lines of code:
bot/bot/cogs/off_topic_names.py
Lines 59 to 61 in e70c962
To handle it, we could simply include a
try-exceptblock and log the exception in theexceptblock. I'm not sure if we want to log the entire exception, since the exception text could be a massive HTML-response generated by cloudflare. Logging the failure with the response code should generally give us enough to determine the cause of the failure.