"Properly" handle CloudFlare errors in webhook execution

This commit is contained in:
Ske 2020-05-01 19:21:02 +02:00
parent b927d0c2b7
commit e7b28261b2

View File

@ -81,6 +81,12 @@ namespace PluralKit.Bot
{ {
response = await webhook.ExecuteAsync(dwb); response = await webhook.ExecuteAsync(dwb);
} }
catch (JsonReaderException)
{
// This happens sometimes when we hit a CloudFlare error (or similar) on Discord's end
// Nothing we can do about this - happens sometimes under server load, so just drop the message and give up
throw new WebhookExecutionErrorOnDiscordsEnd();
}
catch (NotFoundException e) catch (NotFoundException e)
{ {
if (e.JsonMessage.Contains("10015") && !hasRetried) if (e.JsonMessage.Contains("10015") && !hasRetried)