From e7b28261b2bee80ad7843be628421075f57bd16c Mon Sep 17 00:00:00 2001 From: Ske Date: Fri, 1 May 2020 19:21:02 +0200 Subject: [PATCH] "Properly" handle CloudFlare errors in webhook execution --- PluralKit.Bot/Services/WebhookExecutorService.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/PluralKit.Bot/Services/WebhookExecutorService.cs b/PluralKit.Bot/Services/WebhookExecutorService.cs index 4d2c3a15..90ea2c68 100644 --- a/PluralKit.Bot/Services/WebhookExecutorService.cs +++ b/PluralKit.Bot/Services/WebhookExecutorService.cs @@ -81,6 +81,12 @@ namespace PluralKit.Bot { 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) { if (e.JsonMessage.Contains("10015") && !hasRetried)