diff --git a/CHANGELOG.md b/CHANGELOG.md index 67ac953..65e2c43 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - IcdEnvironment - Added CrestronDevicePlatform, removed from CrestronRuntimeEnvironment, to support SimplWindows on VC-4 - Fixed IcdEnvironment CrestronRuntimeEnvironment uses in IcdConsole, PathUtils, and ProgramUtils - Fixed preprocessors in IcdDirectory + - Added exception handling to ThreadedWorkerQueue ## [16.0.5] 2022-07-11 ### Changed diff --git a/ICD.Common.Utils/Threading/ThreadedWorkerQueue.cs b/ICD.Common.Utils/Threading/ThreadedWorkerQueue.cs index 2adf16a..33a80fe 100644 --- a/ICD.Common.Utils/Threading/ThreadedWorkerQueue.cs +++ b/ICD.Common.Utils/Threading/ThreadedWorkerQueue.cs @@ -1,6 +1,8 @@ using System; using ICD.Common.Properties; using ICD.Common.Utils.Collections; +using ICD.Common.Utils.Services; +using ICD.Common.Utils.Services.Logging; using ICD.Common.Utils.Timers; namespace ICD.Common.Utils @@ -370,7 +372,15 @@ namespace ICD.Common.Utils while (true) { // Run the process action - m_ProcessAction(item); + // todo: Have exceptions raise an event in a new thread, maybe configurable exception handling + try + { + m_ProcessAction(item); + } + catch (Exception e) + { + ServiceProvider.GetService().AddEntry(eSeverity.Error, e, "Exception in ThreadedWorkingQueue process action:{0}", e.Message); + } m_QueueSection.Enter(); try