From 6f6555d19c4e030d9aaf4217b7c35dcdfd111e4d Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Sun, 19 May 2024 12:54:51 +0000 Subject: [PATCH] Downgrade fatal exception to disconnection message --- lib/network/NetworkConnection.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/network/NetworkConnection.cpp b/lib/network/NetworkConnection.cpp index f7593e75c..5aa88b312 100644 --- a/lib/network/NetworkConnection.cpp +++ b/lib/network/NetworkConnection.cpp @@ -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 message(expectedPacketSize);