Exceptions: Straight line convention refactor
This commit is contained in:
+27
-8
@@ -16,7 +16,7 @@ Body::Body(Mind &parent, const std::shared_ptr<sscl::PuppetThread> &thread)
|
||||
{
|
||||
}
|
||||
|
||||
BodyViralPostingInvoker<bool> Body::initializeCReq()
|
||||
BodyViralPostingInvoker<void> Body::initializeCReq()
|
||||
{
|
||||
auto self = sscl::ComponentThread::getSelf();
|
||||
if (self->id != SmoThreadId::BODY)
|
||||
@@ -71,10 +71,19 @@ BodyViralPostingInvoker<bool> Body::initializeCReq()
|
||||
<< attachResults.nSucceeded << " of " << attachResults.nTotal
|
||||
<< " sense devices." << "\n";
|
||||
|
||||
co_return attachResults.nSucceeded > 0;
|
||||
if (attachResults.nTotal > 0 && attachResults.nSucceeded == 0)
|
||||
{
|
||||
throw std::runtime_error(
|
||||
std::string(__func__)
|
||||
+ ": Failed to attach any of "
|
||||
+ std::to_string(attachResults.nTotal)
|
||||
+ " requested sense devices");
|
||||
}
|
||||
|
||||
co_return;
|
||||
}
|
||||
|
||||
BodyViralPostingInvoker<bool> Body::finalizeCReq()
|
||||
BodyViralPostingInvoker<void> Body::finalizeCReq()
|
||||
{
|
||||
auto self = sscl::ComponentThread::getSelf();
|
||||
if (self->id != SmoThreadId::BODY)
|
||||
@@ -89,15 +98,25 @@ BodyViralPostingInvoker<bool> Body::finalizeCReq()
|
||||
{
|
||||
std::cout << "Mrntt: Body component not initialized. "
|
||||
<< "Skipping finalization." << "\n";
|
||||
co_return true;
|
||||
co_return;
|
||||
}
|
||||
|
||||
std::cout << "Mrntt: About to detach all sense devices." << "\n";
|
||||
sscl::MultiOperationResultSet detachResults = co_await
|
||||
device::DeviceManager::getInstance().detachAllAttachedDeviceRolesCReq();
|
||||
std::cout << "Mrntt: Successfully detached "
|
||||
<< detachResults.nSucceeded << " of " << detachResults.nTotal
|
||||
<< " sense devices." << "\n";
|
||||
|
||||
if (detachResults.nFailed > 0)
|
||||
{
|
||||
std::cerr << "Mrntt: Failed to detach "
|
||||
<< detachResults.nFailed << " of " << detachResults.nTotal
|
||||
<< " sense devices." << "\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "Mrntt: Successfully detached "
|
||||
<< detachResults.nSucceeded << " of " << detachResults.nTotal
|
||||
<< " sense devices." << "\n";
|
||||
}
|
||||
|
||||
std::cout << "Mrntt: About to finalize all stim buff api libs." << "\n";
|
||||
co_await stim_buff::StimBuffApiManager::getInstance()
|
||||
@@ -106,7 +125,7 @@ BodyViralPostingInvoker<bool> Body::finalizeCReq()
|
||||
std::cout << "Mrntt: About to unload all stim buff api libs." << "\n";
|
||||
stim_buff::StimBuffApiManager::getInstance().unloadAllStimBuffApiLibs();
|
||||
|
||||
co_return detachResults.nSucceeded == detachResults.nTotal;
|
||||
co_return;
|
||||
}
|
||||
|
||||
} // namespace body
|
||||
|
||||
Reference in New Issue
Block a user