Group: Enable aggregate exception to be passed as ptr

This commit is contained in:
2026-06-07 19:33:42 -04:00
parent edde8f4a64
commit 44894299b4
2 changed files with 37 additions and 5 deletions
+16 -5
View File
@@ -564,10 +564,10 @@ struct Group
memberAdapterCoro(memberInvoker, settlementIndex);
}
void checkForAndReThrowGroupExceptions() const
std::exception_ptr captureAggregatedGroupExceptions() const
{
std::ostringstream ostream;
bool doThrow = false;
bool hasFailures = false;
for (auto &item : s.rsrc.settlements)
{
@@ -577,7 +577,7 @@ struct Group
assert(item.calleeException);
doThrow = true;
hasFailures = true;
ostream << "Exc thrown in Group Adapter: ";
try {
std::rethrow_exception(item.calleeException);
@@ -589,8 +589,19 @@ struct Group
ostream << "\n";
}
if (doThrow) {
throw std::runtime_error(ostream.str());
if (!hasFailures) {
return nullptr;
}
return std::make_exception_ptr(std::runtime_error(ostream.str()));
}
void checkForAndReThrowGroupExceptions() const
{
std::exception_ptr aggregatedException =
captureAggregatedGroupExceptions();
if (aggregatedException) {
std::rethrow_exception(aggregatedException);
}
}