From dd3e24f933b3c01e1e588f75af1526f2149e9c70 Mon Sep 17 00:00:00 2001 From: jvyden Date: Wed, 9 Mar 2022 17:34:40 -0500 Subject: [PATCH] Properly handle exceptions in DebugWarmupLifetime --- ProjectLighthouse/Startup/DebugWarmupLifetime.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/ProjectLighthouse/Startup/DebugWarmupLifetime.cs b/ProjectLighthouse/Startup/DebugWarmupLifetime.cs index 8454289c..b06083ca 100644 --- a/ProjectLighthouse/Startup/DebugWarmupLifetime.cs +++ b/ProjectLighthouse/Startup/DebugWarmupLifetime.cs @@ -38,7 +38,16 @@ public class DebugWarmupLifetime : IHostLifetime using HttpClient client = new(); Logger.Log("Warming up Hot Reload...", LoggerLevelStartup.Instance); - client.GetAsync(ServerSettings.Instance.ServerListenUrl).Wait(); + try + { + client.GetAsync(ServerSettings.Instance.ServerListenUrl).Wait(); + } + catch(Exception e) + { + Logger.Log("An error occurred while attempting to warm up hot reload. Initial page load will be delayed.", LoggerLevelStartup.Instance); + Logger.Log(e.Message, LoggerLevelStartup.Instance); + return; + } Logger.Log("Hot Reload is ready to go!", LoggerLevelStartup.Instance); }