From d23019926bd1852187d7a1ff81feeaa53b66c9c5 Mon Sep 17 00:00:00 2001 From: James Tombleson Date: Sun, 2 Apr 2023 08:03:59 -0700 Subject: [PATCH] catching another http error code. (#19) --- .../Notifications/Discord/DiscordWebhookClient.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Newsbot.Collector.Services/Notifications/Discord/DiscordWebhookClient.cs b/Newsbot.Collector.Services/Notifications/Discord/DiscordWebhookClient.cs index 015fb2b..8559a71 100644 --- a/Newsbot.Collector.Services/Notifications/Discord/DiscordWebhookClient.cs +++ b/Newsbot.Collector.Services/Notifications/Discord/DiscordWebhookClient.cs @@ -37,7 +37,13 @@ public class DiscordWebhookClient : IDiscordNotificatioClient // can be 204 or a message, might be 200 Console.WriteLine(resp.Result.StatusCode); if (resp.Result.StatusCode != HttpStatusCode.NoContent) + { throw new Exception("Message was not accepted by the sever."); + } + if (resp.Result.StatusCode == HttpStatusCode.BadRequest) + { + throw new Exception("Message was not accepted. Make sure all values are not null"); + } } } } \ No newline at end of file