fix(ThreadedWorkerQueue): Exception handling of exceptions in process action

This commit is contained in:
Drew Tingen
2022-11-30 12:20:50 -05:00
parent 2700f5018a
commit 2aa05f3ee8
2 changed files with 12 additions and 1 deletions

View File

@@ -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

View File

@@ -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<ILoggerService>().AddEntry(eSeverity.Error, e, "Exception in ThreadedWorkingQueue process action:{0}", e.Message);
}
m_QueueSection.Enter();
try