mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-08-31 19:08:29 +00:00
fix: return early if config devices are null, with an appropriate log message
This commit is contained in:
parent
dc656bddf1
commit
89a1b662b0
1 changed files with 46 additions and 41 deletions
|
|
@ -1,7 +1,10 @@
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.IO.Compression;
|
using System.IO.Compression;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
using Crestron.SimplSharp.CrestronIO;
|
using Crestron.SimplSharp.CrestronIO;
|
||||||
using Crestron.SimplSharpPro;
|
using Crestron.SimplSharpPro;
|
||||||
|
|
@ -12,14 +15,11 @@ using PepperDash.Core.Adapters;
|
||||||
using PepperDash.Essentials.Core;
|
using PepperDash.Essentials.Core;
|
||||||
using PepperDash.Essentials.Core.Bridges;
|
using PepperDash.Essentials.Core.Bridges;
|
||||||
using PepperDash.Essentials.Core.Config;
|
using PepperDash.Essentials.Core.Config;
|
||||||
using PepperDash.Essentials.Core.Routing;
|
|
||||||
using System.Threading;
|
|
||||||
using Timeout = Crestron.SimplSharp.Timeout;
|
|
||||||
using Serilog.Events;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using PepperDash.Essentials.Core.Web;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
|
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
|
||||||
|
using PepperDash.Essentials.Core.Routing;
|
||||||
|
using PepperDash.Essentials.Core.Web;
|
||||||
|
using Serilog.Events;
|
||||||
|
using Timeout = Crestron.SimplSharp.Timeout;
|
||||||
|
|
||||||
namespace PepperDash.Essentials;
|
namespace PepperDash.Essentials;
|
||||||
|
|
||||||
|
|
@ -506,9 +506,13 @@ public class ControlSystem : CrestronControlSystem, ILoadConfig, IInitialization
|
||||||
new Core.Monitoring.SystemMonitorController("systemMonitor"));
|
new Core.Monitoring.SystemMonitorController("systemMonitor"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ConfigReader.ConfigObject is not null)
|
if (ConfigReader.ConfigObject is null)
|
||||||
{
|
{
|
||||||
Debug.LogMessage(LogEventLevel.Warning, "LoadDevices: ConfigObject is null. Cannot load devices.");
|
Debug.LogMessage(LogEventLevel.Warning, "LoadDevices: ConfigObject is null. Cannot load devices.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Debug.LogInformation("Loading devices from config.");
|
||||||
|
|
||||||
foreach (var devConf in ConfigReader.ConfigObject.Devices)
|
foreach (var devConf in ConfigReader.ConfigObject.Devices)
|
||||||
{
|
{
|
||||||
|
|
@ -549,10 +553,11 @@ public class ControlSystem : CrestronControlSystem, ILoadConfig, IInitialization
|
||||||
Debug.LogMessage(e, "ERROR: Creating device {deviceKey:l}. Skipping device.", args: new[] { devConf.Key });
|
Debug.LogMessage(e, "ERROR: Creating device {deviceKey:l}. Skipping device.", args: new[] { devConf.Key });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
Debug.LogMessage(LogEventLevel.Information, "All Devices Loaded.");
|
Debug.LogMessage(LogEventLevel.Information, "All Devices Loaded.");
|
||||||
|
|
||||||
|
return;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue