public static void SendToTelegram(string exception) { try { string menssage = "Error message: " + exception; telegramBotClient.SendTextMessageAsync(idGroup, menssage); } catch (IOException ioException) { TelegramBot telegramBot = new TelegramBot(); LogException.Log(telegramBot, ioException); } }
/// <summary> /// This method sends the exception to telegram /// </summary> /// <param name="exception">The exception to send</param> public static void SendToTelegram(Exception exception) { try { string menssage = "Error message: " + exception.Message; if (exception.InnerException != null) { menssage = menssage + "\nInner exception: " + exception.InnerException.Message; } menssage = menssage + "\nStack trace: " + exception.StackTrace; telegramBotClient.SendTextMessageAsync(idGroup, menssage); } catch (IOException ioException) { TelegramBot telegramBot = new TelegramBot(); LogException.Log(telegramBot, ioException); } }