libstore: using throwing finally in withFramedSink

the duplication of exception handling was added without justification,
so we can only assume that it was done like this because Finally could
not throw exceptions safely. since this has now been rectified we will
deduplicate this handler code again.

Change-Id: I40721f3378c0fd9f34e2914a16d383f6e2713b40
This commit is contained in:
eldritch horrors 2024-03-21 23:08:02 +01:00
parent dd06f9b792
commit 2d3fd6b9ab

View file

@ -1067,27 +1067,15 @@ void RemoteStore::ConnectionHandle::withFramedSink(std::function<void(Sink & sin
Finally joinStderrThread([&]() Finally joinStderrThread([&]()
{ {
if (stderrThread.joinable()) {
stderrThread.join(); stderrThread.join();
if (ex) { if (ex) {
try {
std::rethrow_exception(ex); std::rethrow_exception(ex);
} catch (...) {
ignoreException();
}
}
} }
}); });
{
FramedSink sink((*this)->to, ex); FramedSink sink((*this)->to, ex);
fun(sink); fun(sink);
sink.flush(); sink.flush();
} }
stderrThread.join();
if (ex)
std::rethrow_exception(ex);
}
} }