1
0

exception handling with debug logs

This commit is contained in:
Emagi 2024-12-02 19:40:15 -05:00
parent 031bb0c518
commit 8a163875fb

View File

@ -719,9 +719,21 @@ void HTTPSClientPool::startPolling() {
auto server = clientPair.first.first; auto server = clientPair.first.first;
auto port = clientPair.first.second; auto port = clientPair.first.second;
LogWrite(PEERING__DEBUG, 5, "Peering", "%s: startPolling for %s:%s.", __FUNCTION__, server.c_str(), port.c_str()); LogWrite(PEERING__DEBUG, 5, "Peering", "%s: startPolling for %s:%s.", __FUNCTION__, server.c_str(), port.c_str());
std::async(std::launch::async, [this, server, port]() { try {
pollPeerHealth(server, port); std::async(std::launch::async, [this, server, port]() {
}); try {
pollPeerHealth(server, port);
} catch (const std::exception& e) {
LogWrite(PEERING__DEBUG, 1, "Peering", "Exception in pollPeerHealth for %s:%s: %s", server.c_str(), port.c_str(), e.what());
} catch (...) {
LogWrite(PEERING__DEBUG, 1, "Peering", "Unknown exception in pollPeerHealth for %s:%s.", server.c_str(), port.c_str());
}
});
} catch (const std::exception& e) {
LogWrite(PEERING__DEBUG, 1, "Peering", "Failed to start async task for %s:%s: %s", server.c_str(), port.c_str(), e.what());
} catch (...) {
LogWrite(PEERING__DEBUG, 1, "Peering", "Unknown exception when starting async task for %s:%s.", server.c_str(), port.c_str());
}
} }
} }