1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Downgrade fatal exception to disconnection message

This commit is contained in:
Ivan Savenko 2024-05-19 12:54:51 +00:00
parent d502850054
commit 6f6555d19c

View File

@ -117,7 +117,9 @@ void NetworkConnection::onPacketReceived(const boost::system::error_code & ec, u
if (readBuffer.size() < expectedPacketSize)
{
throw std::runtime_error("Failed to read packet! " + std::to_string(readBuffer.size()) + " bytes read, but " + std::to_string(expectedPacketSize) + " bytes expected!");
// FIXME: figure out what causes this. This should not be possible without error set
std::string errorMessage = "Failed to read packet! " + std::to_string(readBuffer.size()) + " bytes read, but " + std::to_string(expectedPacketSize) + " bytes expected!";
onError(errorMessage);
}
std::vector<std::byte> message(expectedPacketSize);