From 794dee7f580e7788d859ae5289dcce44d58702dc Mon Sep 17 00:00:00 2001 From: Florian Zevedei Date: Thu, 7 Dec 2023 17:49:35 +0100 Subject: [PATCH] improved readability --- TelegramBotBase/Base/MessageClient.cs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/TelegramBotBase/Base/MessageClient.cs b/TelegramBotBase/Base/MessageClient.cs index b95131f..17ec7f3 100644 --- a/TelegramBotBase/Base/MessageClient.cs +++ b/TelegramBotBase/Base/MessageClient.cs @@ -199,18 +199,19 @@ public class MessageClient if (eventHandlers != null) { await eventHandlers; + return; + } + + //Fallback when no event handler is used. + if (update.Exception is ApiRequestException exApi) + { + Console.WriteLine($"Telegram API Error:\n[{exApi.ErrorCode}]\n{exApi.Message}"); } else { - if (update.Exception is ApiRequestException exApi) - { - Console.WriteLine($"Telegram API Error:\n[{exApi.ErrorCode}]\n{exApi.Message}"); - } - else - { - Console.WriteLine(update.Exception.ToString()); - } + Console.WriteLine(update.Exception.ToString()); } + } #endregion