replace std::runtime_exception with PrismLauncher Exception + add try/catch

This commit is contained in:
iTrooz
2024-11-17 18:56:08 +01:00
parent 8cf0c2029c
commit 0d830e56e9
2 changed files with 17 additions and 10 deletions

View File

@ -145,9 +145,14 @@ class ServerPingTask : public Task {
resolver->deleteLater();
qDebug() << "Resolved Addresse for" << domain << ": " << ip << ":" << port;
McClient client(nullptr, domain, ip, port);
int online = client.getOnlinePlayers();
qDebug() << "Online players: " << online;
m_server.m_currentPlayers = online;
try {
int online = client.getOnlinePlayers();
qDebug() << "Online players: " << online;
m_server.m_currentPlayers = online;
} catch(const Exception& e) {
qDebug() << "Failed to get online players: " << e.cause();
}
});
resolver->ping();
}