mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-04-12 12:06:58 +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))
|
||||
// Directory.Create(dir);
|
||||
|
||||
var fileName = GetMemoryFileName();
|
||||
|
||||
LogMessage(LogEventLevel.Information, "Loading debug settings file from {fileName}", fileName);
|
||||
|
||||
using (var sw = new StreamWriter(fileName))
|
||||
try
|
||||
{
|
||||
var json = JsonConvert.SerializeObject(_contexts);
|
||||
sw.Write(json);
|
||||
sw.Flush();
|
||||
var fileName = GetMemoryFileName();
|
||||
|
||||
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