mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-04-13 20:47:04 +00:00
fix: add error handling when saving debug settings
This commit is contained in:
parent
bcb65c7fa4
commit
426ef4ad6b
1 changed files with 17 additions and 8 deletions
|
|
@ -960,15 +960,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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue