Log early exceptions to console (#893)

This commit is contained in:
Karl Burtram
2019-11-21 13:00:15 -08:00
committed by GitHub
parent b763abae47
commit e9ac5b7ff5

View File

@@ -48,9 +48,17 @@ namespace Microsoft.SqlTools.ServiceLayer
serviceHost.WaitForExit();
}
catch (Exception e)
catch (Exception ex)
{
Logger.WriteWithCallstack(TraceEventType.Critical, $"An unhandled exception occurred: {e}");
try
{
Logger.WriteWithCallstack(TraceEventType.Critical, $"An unhandled exception occurred: {ex}");
}
catch (Exception loggerEx)
{
Console.WriteLine($"Error: Logger unavailable: {loggerEx}");
Console.WriteLine($"An unhandled exception occurred: {ex}");
}
Environment.Exit(1);
}
finally