From 5b17368e1b338d2b492a2f32514a4f527d1180be Mon Sep 17 00:00:00 2001 From: Jordan Dominion Date: Fri, 14 Jul 2023 09:37:13 -0400 Subject: [PATCH] Prevent DumpOnHealthCheckRestart from crashing the monitor --- .../Components/Watchdog/WatchdogBase.cs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/Tgstation.Server.Host/Components/Watchdog/WatchdogBase.cs b/src/Tgstation.Server.Host/Components/Watchdog/WatchdogBase.cs index a1f1091807..09474acdb5 100644 --- a/src/Tgstation.Server.Host/Components/Watchdog/WatchdogBase.cs +++ b/src/Tgstation.Server.Host/Components/Watchdog/WatchdogBase.cs @@ -4,7 +4,10 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; +using BetterWin32Errors; + using Microsoft.Extensions.Logging; + using Serilog.Context; using Tgstation.Server.Api.Models; @@ -1086,7 +1089,18 @@ namespace Tgstation.Server.Host.Components.Watchdog if (ActiveLaunchParameters.DumpOnHealthCheckRestart.Value) { Logger.LogDebug("DumpOnHealthCheckRestart enabled."); - await CreateDump(cancellationToken); + try + { + await CreateDump(cancellationToken); + } + catch (JobException ex) + { + Logger.LogWarning(ex, "Creating dump failed!"); + } + catch (Win32Exception ex) + { + Logger.LogWarning(ex, "Creating dump failed!"); + } } else Logger.LogTrace("DumpOnHealthCheckRestart disabled.");