ExceptionInd: Remove duplicate invocations

This commit is contained in:
2025-08-03 10:32:02 -04:00
parent d4898bbca1
commit e2e589dc17
2 changed files with 11 additions and 4 deletions
+6 -4
View File
@@ -108,24 +108,26 @@ void ComponentThread::main(ComponentThread& self)
*/ */
for (self.keepLooping = true; self.keepLooping;) for (self.keepLooping = true; self.keepLooping;)
{ {
bool sendExceptionInd = false;
try { try {
self.getIoService().reset(); self.getIoService().reset();
self.getIoService().run(); self.getIoService().run();
} }
catch (const std::exception& e) catch (const std::exception& e)
{ {
sendExceptionInd = true;
std::cerr << self.name << ":" << __func__ std::cerr << self.name << ":" << __func__
<< ": Exception occurred: " << e.what() << "\n"; << ": Exception occurred: " << e.what() << "\n";
mrntt::mrntt->exceptionInd(self);
} }
catch (...) catch (...)
{ {
sendExceptionInd = true;
std::cerr << self.name << ":" << __func__ std::cerr << self.name << ":" << __func__
<< ": Unknown exception occurred" << "\n"; << ": Unknown exception occurred" << "\n";
mrntt::mrntt->exceptionInd(self);
} }
if (sendExceptionInd) { mrntt::mrntt->exceptionInd(self); }
} }
std::cout << self.name << ":" << __func__ << ": Exited event loop" << "\n"; std::cout << self.name << ":" << __func__ << ": Exited event loop" << "\n";
+5
View File
@@ -106,20 +106,25 @@ void ComponentThread::marionetteMain(ComponentThread& self)
*/ */
for (self.keepLooping = true; self.keepLooping;) for (self.keepLooping = true; self.keepLooping;)
{ {
bool sendExceptionInd = false;
try { try {
self.getIoService().reset(); self.getIoService().reset();
self.getIoService().run(); self.getIoService().run();
} }
catch (const std::exception& e) catch (const std::exception& e)
{ {
sendExceptionInd = true;
std::cerr << self.name << ":" << __func__ std::cerr << self.name << ":" << __func__
<< ": Exception occurred: " << e.what() << "\n"; << ": Exception occurred: " << e.what() << "\n";
} }
catch (...) catch (...)
{ {
sendExceptionInd = true;
std::cerr << self.name << ":" << __func__ std::cerr << self.name << ":" << __func__
<< ": Unknown exception occurred" << "\n"; << ": Unknown exception occurred" << "\n";
} }
if (sendExceptionInd) { self.exceptionInd(self); }
} }
std::cout << __func__ << ": Exited event loop" << "\n"; std::cout << __func__ << ": Exited event loop" << "\n";