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,8 +9,15 @@
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();
try
{
connection.WriteBytes(bytesToSend); 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)
{ {