Catch runtime error writing to socket

This commit is contained in:
2019-06-16 11:13:21 +02:00
parent 9f5e4e2357
commit 14740e4a64

View File

@@ -9,7 +9,14 @@
void ConnectionOperator::SendResponse(Connection const & connection, Http::Response const & response) const void ConnectionOperator::SendResponse(Connection const & connection, Http::Response const & response) const
{ {
auto bytesToSend = response.Serialize(); auto bytesToSend = response.Serialize();
connection.WriteBytes(bytesToSend); try
{
connection.WriteBytes(bytesToSend);
}
catch(std::runtime_error & e)
{
Logger::GetInstance().Error("Error writing data to connection");
}
} }
void ConnectionOperator::HandleNewConnection(Connection const & newConnection) void ConnectionOperator::HandleNewConnection(Connection const & newConnection)