From 71cf7ef4dfb775ee969cdaf01bb5b6c80f417f19 Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Mon, 13 Apr 2026 21:01:22 -0600 Subject: [PATCH] feat: Add console command to report initialization exceptions for improved diagnostics --- src/PepperDash.Essentials/ControlSystem.cs | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/PepperDash.Essentials/ControlSystem.cs b/src/PepperDash.Essentials/ControlSystem.cs index 5a6b8777..388a9368 100644 --- a/src/PepperDash.Essentials/ControlSystem.cs +++ b/src/PepperDash.Essentials/ControlSystem.cs @@ -191,6 +191,9 @@ public class ControlSystem : CrestronControlSystem, ILoadConfig, IInitialization CrestronConsole.AddNewConsoleCommand(DeviceManager.GetRoutingPorts, "getroutingports", "Reports all routing ports, if any. Requires a device key", ConsoleAccessLevelEnum.AccessOperator); + CrestronConsole.AddNewConsoleCommand(PrintInitializationExceptions, + "getinitializationexceptions", "Reports any exceptions that occurred during initialization", ConsoleAccessLevelEnum.AccessOperator); + DeviceManager.AddDevice(new EssentialsWebApi("essentialsWebApi", "Essentials Web API")); if (!Debug.DoNotLoadConfigOnNextBoot) @@ -823,8 +826,28 @@ public class ControlSystem : CrestronControlSystem, ILoadConfig, IInitialization } Debug.LogMessage(LogEventLevel.Information, "All Rooms Loaded."); + } + private void PrintInitializationExceptions(string args) + { + if(args.Contains("?")) + { + CrestronConsole.ConsoleCommandResponse("Usage: getinitializationexceptions\r\n"); + CrestronConsole.ConsoleCommandResponse("Reports any exceptions that occurred during initialization.\r\n"); + return; + } + if (InitializationExceptions.Count == 0) + { + CrestronConsole.ConsoleCommandResponse("No initialization exceptions occurred.\r\n"); + return; + } + + CrestronConsole.ConsoleCommandResponse("Initialization Exceptions:\r\n"); + foreach (var ex in InitializationExceptions) + { + CrestronConsole.ConsoleCommandResponse(" - {0}: {1}\r\n", ex.GetType().FullName, ex.Message); + } }