From 21b5b5e43572b12b689d1b3f8512b9a6d9bff53d Mon Sep 17 00:00:00 2001 From: Jordan Brown Date: Thu, 13 Sep 2018 19:36:08 -0400 Subject: [PATCH] Send an error message to chat when watchdog startup fails --- src/Tgstation.Server.Host/Components/Watchdog/Watchdog.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Tgstation.Server.Host/Components/Watchdog/Watchdog.cs b/src/Tgstation.Server.Host/Components/Watchdog/Watchdog.cs index 6ce7108c42..939661e74d 100644 --- a/src/Tgstation.Server.Host/Components/Watchdog/Watchdog.cs +++ b/src/Tgstation.Server.Host/Components/Watchdog/Watchdog.cs @@ -735,6 +735,13 @@ namespace Tgstation.Server.Host.Components.Watchdog } catch (Exception e) { + var originalChatTask = chatTask; + async Task ChainChatTaskWithErrorMessage() + { + await originalChatTask.ConfigureAwait(false); + await chat.SendWatchdogMessage("Startup failed!", cancellationToken).ConfigureAwait(false); + } + chatTask = ChainChatTaskWithErrorMessage(); logger.LogWarning("Failed to start watchdog: {0}", e.ToString()); throw; }