UniverseClient: log packet type when a packet throws an exception

This commit is contained in:
Kae 2024-09-02 22:18:03 +10:00
parent ac7577b4df
commit efa57d3081

View File

@ -648,6 +648,7 @@ void UniverseClient::setPause(bool pause) {
void UniverseClient::handlePackets(List<PacketPtr> const& packets) {
for (auto const& packet : packets) {
try {
if (auto clientContextUpdate = as<ClientContextUpdatePacket>(packet)) {
m_clientContext->readUpdate(clientContextUpdate->updateData);
m_playerStorage->applyShipUpdates(m_clientContext->playerUuid(), m_clientContext->newShipUpdates());
@ -702,6 +703,11 @@ void UniverseClient::handlePackets(List<PacketPtr> const& packets) {
m_worldClient->handleIncomingPackets({packet});
}
}
catch (StarException const& e) {
Logger::error("Exception thrown while handling {} packet", PacketTypeNames.getRight(packet->type()));
throw;
}
}
}
void UniverseClient::reset() {