mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-01-11 19:44:52 +00:00
fix: add error handling when saving debug settings
This commit is contained in:
@@ -957,15 +957,24 @@ public static class Debug
|
|||||||
//if (!Directory.Exists(dir))
|
//if (!Directory.Exists(dir))
|
||||||
// Directory.Create(dir);
|
// Directory.Create(dir);
|
||||||
|
|
||||||
var fileName = GetMemoryFileName();
|
try
|
||||||
|
|
||||||
LogMessage(LogEventLevel.Information, "Loading debug settings file from {fileName}", fileName);
|
|
||||||
|
|
||||||
using (var sw = new StreamWriter(fileName))
|
|
||||||
{
|
{
|
||||||
var json = JsonConvert.SerializeObject(_contexts);
|
var fileName = GetMemoryFileName();
|
||||||
sw.Write(json);
|
|
||||||
sw.Flush();
|
LogMessage(LogEventLevel.Information, "Loading debug settings file from {fileName}", fileName);
|
||||||
|
|
||||||
|
using (var sw = new StreamWriter(fileName))
|
||||||
|
{
|
||||||
|
var json = JsonConvert.SerializeObject(_contexts);
|
||||||
|
sw.Write(json);
|
||||||
|
sw.Flush();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
ErrorLog.Error("Exception saving debug settings: {message}", ex);
|
||||||
|
CrestronConsole.PrintLine("Exception saving debug settings: {message}", ex.Message);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user