Properly handle exceptions in DebugWarmupLifetime

This commit is contained in:
jvyden 2022-03-09 17:34:40 -05:00
commit dd3e24f933
No known key found for this signature in database
GPG key ID: 18BCF2BE0262B278

View file

@ -38,7 +38,16 @@ public class DebugWarmupLifetime : IHostLifetime
using HttpClient client = new(); using HttpClient client = new();
Logger.Log("Warming up Hot Reload...", LoggerLevelStartup.Instance); 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); Logger.Log("Hot Reload is ready to go!", LoggerLevelStartup.Instance);
} }